mirror of
https://github.com/thelounge/thelounge
synced 2024-11-27 06:20:26 +00:00
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
1 changed files with 5 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue