-
Notifications
You must be signed in to change notification settings - Fork 762
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use FormData, File and Blob from fetch implementation
Refs #3137
- Loading branch information
Showing
13 changed files
with
58 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// we cannot use `node-fetch@3` as it's pure ESM package not compatible with CommonJS | ||
import fetch, { Response, Headers, Request } from 'node-fetch-commonjs'; | ||
import fetch, { Response, Headers, Request, FormData, File, Blob } from 'node-fetch-commonjs'; | ||
|
||
export { fetch, Response, Headers, Request }; | ||
export { fetch, Response, Headers, Request, FormData, File, Blob }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { fetch, Response, Headers, Request } from 'undici'; | ||
import { Blob } from 'buffer'; | ||
import { fetch, Response, Headers, Request, FormData, File } from 'undici'; | ||
|
||
export { fetch, Response, Headers, Request }; | ||
const BlobU = typeof fetch === 'undefined' ? undefined : Blob; | ||
|
||
export { fetch, Response, Headers, Request, FormData, File, BlobU as Blob }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// we're targeting browsers that already support fetch API | ||
const { fetch, Response, Headers, Request } = globalThis; | ||
const { fetch, Response, Headers, Request, FormData, File, Blob } = globalThis; | ||
|
||
export { fetch, Response, Headers, Request }; | ||
export { fetch, Response, Headers, Request, FormData, File, Blob }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { File, Blob } from 'formdata-node'; | ||
import * as undici from 'undici'; | ||
|
||
import http, { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters