Commit 42ae7afd authored by Julien Enselme's avatar Julien Enselme

Don't cache requests that didn't succeed

parent f190cec5
......@@ -39,6 +39,11 @@ self.addEventListener('fetch', (event) => {
return fetch(event.request)
.then(res => {
const requestSucceeded = res.status >= 200 && res.status <= 300;
if (!requestSucceeded) {
return res;
}
return caches.open(dynamicCacheName)
.then(cache => {
// We can read a response only once. So if we don't clone it here,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment