Skip to content

Commit bfd4926

Browse files
kilimanonurtemizkan
authored andcommitted
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 1a2a33c commit bfd4926

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
@@ -150,8 +150,8 @@ export const normalizeRemixRequest = (request: RemixRequest): Record<string, any
150150
query: parsedURL.query,
151151
href: parsedURL.href,
152152
method: request.method,
153-
// @ts-expect-error - not sure what this supposed to do
154-
headers: headers[Symbol.for('nodejs.util.inspect.custom')](),
153+
// Remix now uses undici, so use standard way to create headers object
154+
headers: Object.fromEntries(headers),
155155
insecureHTTPParser: request.insecureHTTPParser,
156156
agent,
157157

0 commit comments

Comments
 (0)