Skip to content

Commit

Permalink
Preserve headers in PrecacheCacheKeyPlugin (#2914)
Browse files Browse the repository at this point in the history
* Preserve headers in PrecacheCacheKeyPlugin

* Disable linting
  • Loading branch information
jeffposnick committed Aug 24, 2021
1 parent 86818e4 commit 16fa3de
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/workbox-precaching/src/utils/PrecacheCacheKeyPlugin.ts
Expand Up @@ -30,12 +30,16 @@ class PrecacheCacheKeyPlugin implements WorkboxPlugin {
params,
}: WorkboxPluginCallbackParam['cacheKeyWillBeUsed']) => {
// Params is type any, can't change right now.
// eslint-disable-next-line
const cacheKey = params && params.cacheKey ||
this._precacheController.getCacheKeyForURL(request.url);

return cacheKey ? new Request(cacheKey) : request;
}
/* eslint-disable */
const cacheKey =
params?.cacheKey ||
this._precacheController.getCacheKeyForURL(request.url);
/* eslint-enable */

return cacheKey
? new Request(cacheKey, {headers: request.headers})
: request;
};
}

export {PrecacheCacheKeyPlugin};

0 comments on commit 16fa3de

Please sign in to comment.