Skip to content

Commit

Permalink
fix: normalize headers object (nuxt/nuxt#27042)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgdragon committed May 4, 2024
1 parent 8e80b39 commit a5bb094
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export function createFetch(globalOptions: CreateFetchOptions = {}): $Fetch {
// Uppercase method name
context.options.method = context.options.method?.toUpperCase();

// Normalize headers
if (context.options.headers instanceof Headers) {
context.options.headers = Object.fromEntries(context.options.headers);
}

if (context.options.onRequest) {
await context.options.onRequest(context);
}
Expand Down

0 comments on commit a5bb094

Please sign in to comment.