Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from lfantone/main
Browse files Browse the repository at this point in the history
fix(network-first): convert headers to an object first
  • Loading branch information
ShafSpecs authored Aug 28, 2023
2 parents de27384 + abe5458 commit 632fc76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/strategy/networkFirst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export class NetworkFirst extends CacheStrategy {

// Safari throws an error if we try to mutate the headers directly
const newResponse = new Response(body, {
headers: { ...headers, 'X-Remix-Worker': 'yes' },
headers: {
// Headers are a Map so we need to convert to an object first
...Object.fromEntries(headers.entries()),
'X-Remix-Worker': 'yes'
},
status: cachedResponse.status,
statusText: cachedResponse.statusText
});
Expand Down
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"incremental": true,
"target": "es2016",
"target": "es2016",
"useDefineForClassFields": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"resolveJsonModule": true,
"allowJs": true,
"module": "ES2022",
"outDir": "./lib",
"lib": ["ES2022", "DOM", "WebWorker"],
"lib": ["ES2022", "DOM", "WebWorker", "DOM.Iterable"],
"checkJs": true,
"declaration": true,
"declarationMap": true,
Expand All @@ -17,11 +17,11 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noUnusedParameters": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"skipLibCheck": true
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "lib", "types"]
Expand Down

0 comments on commit 632fc76

Please sign in to comment.