Skip to content

Commit

Permalink
fix: improve spec compliance
Browse files Browse the repository at this point in the history
The spec defines Header values as strings
  • Loading branch information
wolfy1339 committed Feb 23, 2024
1 parent 0c23205 commit ca9eb20
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fetch-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export default function fetchWrapper(
return fetch(requestOptions.url, {
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers as HeadersInit,
// Header values must be `string`
headers: Object.entries(requestOptions.headers).map(([name, value]) => [
name,
String(value),
]),
signal: requestOptions.request?.signal,
// duplex must be set if request.body is ReadableStream or Async Iterables.
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
Expand Down

0 comments on commit ca9eb20

Please sign in to comment.