Fix 304 again

This commit is contained in:
Eduard Kuzmenko 2021-06-14 17:29:29 +03:00
parent b74d69ae85
commit 00eb061070

View File

@ -68,10 +68,9 @@ async function requestCache(event: FetchEvent) {
cache.put(event.request, response.clone()); cache.put(event.request, response.clone());
} else if(response.status === 304) { // possible fix for 304 in Safari } else if(response.status === 304) { // possible fix for 304 in Safari
const url = event.request.url.replace(/\?.+$/, '') + '?' + (Math.random() * 100000 | 0); const url = event.request.url.replace(/\?.+$/, '') + '?' + (Math.random() * 100000 | 0);
const request = new Request(url); response = await fetch(url);
response = await fetch(request);
if(isCorrectResponse(response)) { if(isCorrectResponse(response)) {
cache.put(request, response.clone()); cache.put(event.request, response.clone());
} }
} }