fix(nitro): pass Headers to createFetch (#2615)

This commit is contained in:
Daniel Roe 2022-01-05 18:19:23 +00:00 committed by GitHub
parent 11becef735
commit 6d88a7314d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import '../app/config' import '../app/config'
import { createApp, useBase } from 'h3' import { createApp, useBase } from 'h3'
import { createFetch } from 'ohmyfetch' import { createFetch, Headers } from 'ohmyfetch'
import destr from 'destr' import destr from 'destr'
import { createCall, createFetch as createLocalFetch } from 'unenv/runtime/fetch/index' import { createCall, createFetch as createLocalFetch } from 'unenv/runtime/fetch/index'
import { timingMiddleware } from './timing' import { timingMiddleware } from './timing'
@ -22,6 +22,6 @@ export const handle = useBase(process.env.ROUTER_BASE, app)
export const localCall = createCall(handle) export const localCall = createCall(handle)
export const localFetch = createLocalFetch(localCall, globalThis.fetch) export const localFetch = createLocalFetch(localCall, globalThis.fetch)
export const $fetch = createFetch({ fetch: localFetch }) export const $fetch = createFetch({ fetch: localFetch, Headers })
globalThis.$fetch = $fetch globalThis.$fetch = $fetch as any