Skip to content

Commit

Permalink
Adjust service worker partial response
Browse files Browse the repository at this point in the history
  • Loading branch information
gerdesque committed Jan 16, 2024
1 parent 08c7e30 commit bbdd047
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dist/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const cacheName = "ghosthunt-v0.3.2"; // Incremented version number
const cacheName = "ghosthunt-v0.3.3";
const urlsToCacheiOS = [
'/',
'/index.html',
Expand Down Expand Up @@ -186,8 +186,12 @@ const addResourcesToCache = async () => {
};

const putInCache = async (request, response) => {
const cache = await caches.open(cacheName);
await cache.put(request, response);
if (response.status === 200) {
const cache = await caches.open(cacheName);
await cache.put(request, response);
} else {
console.warn('Partial response (status code 206) - not caching:', request.url);
}
};

const cacheFirst = async (request) => {
Expand Down

0 comments on commit bbdd047

Please sign in to comment.