Merge pull request #2973 from thelounge/xpaw/sw-non-200-reject
Serve requests from cache when server responds with non 2xx response
This commit is contained in:
commit
9031999033
@ -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