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:
Pavel Djundik 2019-01-12 10:27:43 +02:00 committed by GitHub
commit 9031999033
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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) {