diff options
author | 2022-05-20 17:26:41 -0400 | |
---|---|---|
committer | 2022-05-20 17:26:41 -0400 | |
commit | 4de53eccef346bed843b491b7ab93987d7d85655 (patch) | |
tree | 1ec5bff18d74ed5859a0b300cf90b9572c9fb9dd /packages/webapi/src/lib/fetch.ts | |
parent | d296eb63ebc08d49184cf98d57cbe6c85d41b474 (diff) | |
download | astro-4de53eccef346bed843b491b7ab93987d7d85655.tar.gz astro-4de53eccef346bed843b491b7ab93987d7d85655.tar.zst astro-4de53eccef346bed843b491b7ab93987d7d85655.zip |
Fix: support `FormData` object on fetch body (#3417)
* refactor: make node-fetch external in rollup build
* deps: make node-fetch standard dep
* refactor: switch to node-fetch pkg ref in fetch.ts
* chore: changeset
* chore: bump webapi to minor change
Diffstat (limited to 'packages/webapi/src/lib/fetch.ts')
-rw-r--r-- | packages/webapi/src/lib/fetch.ts | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/packages/webapi/src/lib/fetch.ts b/packages/webapi/src/lib/fetch.ts index c62c46e30..5dad4e5b4 100644 --- a/packages/webapi/src/lib/fetch.ts +++ b/packages/webapi/src/lib/fetch.ts @@ -3,7 +3,8 @@ import { Headers, Request, Response, -} from 'node-fetch/src/index.js' +} from 'node-fetch' +import type { RequestInit } from 'node-fetch' import Stream from 'node:stream' import * as _ from './utils' @@ -11,7 +12,7 @@ export { Headers, Request, Response } export const fetch = { fetch( - resource: string | URL | Request, + resource: string | Request, init?: Partial<FetchInit> ): Promise<Response> { const resourceURL = new URL( @@ -62,13 +63,7 @@ export const fetch = { type USVString = {} & string interface FetchInit { - body: - | Blob - | BufferSource - | FormData - | URLSearchParams - | ReadableStream - | USVString + body: RequestInit['body'] cache: | 'default' | 'no-store' |