- From: Chris Kruining <notifications@github.com>
- Date: Fri, 13 Apr 2018 12:21:55 +0000 (UTC)
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 13 April 2018 12:22:22 UTC
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:

the quest the service worker then makes:

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