Serve requests from cache when server responds with non 2xx response
This commit is contained in:
parent
2a1e711f42
commit
cb59681cd9
@ -49,6 +49,11 @@ function networkOrCache(uri) {
|
|||||||
return response;
|
return response;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`Request for ${uri.href} failed with HTTP ${response.status}`);
|
||||||
|
|
||||||
|
return Promise.reject("request-failed");
|
||||||
})
|
})
|
||||||
.catch(function() {
|
.catch(function() {
|
||||||
return cache.match(uri).then(function(matching) {
|
return cache.match(uri).then(function(matching) {
|
||||||
|
Loading…
Reference in New Issue
Block a user