[w3c/ServiceWorker] PUT request payload is lost (#1300)

Service worker
```js
self.addEventListener('fetch', e => {
    if(
        e.request.url.match(/\/(?:css|js|image)/) ||
        e.request.url.match(/\/webshop\/.*\.(?:png|jpg|jpeg|webp)/) ||
        !e.request.url.startsWith(self.location.origin)
    )
    {
        e.respondWith(caches.open('cache-dynamic').then(c => c.match(e.request).then(r => {
            let f = fetch(e.request).then(r => {
                c.put(e.request, r.clone());

                return r;
            });

            return r || f;
        })));
    }
    else
    {
        e.respondWith(fetch(e.request));
    }
});
```

the request that is intercepted by the service worker:
![image](https://user-images.githubusercontent.com/5786905/38734323-748f1a48-3f25-11e8-8b49-994777b80db7.png)

the quest the service worker then makes:
![image](https://user-images.githubusercontent.com/5786905/38734384-bc2740e2-3f25-11e8-9778-4876f7ef81a9.png)


this behaviour is happening both in firefox and chrome. server-response indeed gives an error that the data it expects to have is missing.

Is this by design? and/or how do I work around it?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1300

Received on Friday, 13 April 2018 12:22:22 UTC