Skip to content

Commit d911002

Browse files
authored
fix: invalid headers access when using nativeFetch
Remix v2.9+ now supports `undici` native fetch. `normalizeRemixRequest()` would throw an error when processing `headers`. This PR uses the standard `Object.fromEntries()` to convert `Headers` into an object.
1 parent f032f3f commit d911002

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/remix/src/utils/web-fetch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ export const normalizeRemixRequest = (request: RemixRequest): Record<string, any
147147
query: parsedURL.query,
148148
href: parsedURL.href,
149149
method: request.method,
150-
// @ts-expect-error - not sure what this supposed to do
151-
headers: headers[Symbol.for('nodejs.util.inspect.custom')](),
150+
// Remix now uses undici, so use standard way to create headers object
151+
headers: Object.fromEntries(headers),
152152
insecureHTTPParser: request.insecureHTTPParser,
153153
agent,
154154

0 commit comments

Comments
 (0)