[Node fetch] Allow body to accept FormData (#42565)

* Add FormData import

* Add form-data dep

* Add FormData to BodyInit type
This commit is contained in:
Alexis Tyler 2020-02-25 10:40:02 +10:30 committed by GitHub
parent 1c21ecb184
commit 7da30d6637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -10,10 +10,12 @@
// Steve Faulkner <https://github.com/southpolesteve>
// ExE Boss <https://github.com/ExE-Boss>
// Alex Savin <https://github.com/alexandrusavin>
// Alexis Tyler <https://github.com/OmgImAlexis>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import FormData = require('form-data');
import { Agent } from "http";
import { URLSearchParams, URL } from "url";
import { AbortSignal } from "./externals";
@ -204,7 +206,8 @@ export type BodyInit =
| ArrayBufferView
| NodeJS.ReadableStream
| string
| URLSearchParams;
| URLSearchParams
| FormData;
export type RequestInfo = string | URLLike | Request;
declare function fetch(

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"form-data": "^3.0.0"
}
}