Serve requests from cache when server responds with non 2xx response

This commit is contained in:
Pavel Djundik 2019-01-11 21:26:01 +02:00
parent 2a1e711f42
commit cb59681cd9

View file

@ -49,6 +49,11 @@ function networkOrCache(uri) {
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() {
return cache.match(uri).then(function(matching) {