diff --git a/src/fetch.ts b/src/fetch.ts index cd9ebf5..4487df9 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -160,7 +160,8 @@ export function createFetch(globalOptions: CreateFetchOptions): $Fetch { // Set Content-Type and Accept headers to application/json by default // for JSON serializable request bodies. - context.options.headers = new Headers(context.options.headers); + // Pass empty object as older browsers don't support undefined. + context.options.headers = new Headers(context.options.headers || {}); if (!context.options.headers.has("content-type")) { context.options.headers.set("content-type", "application/json"); }