fix(cli/web/fetch): Make Response constructor standard (#5787)

This commit is contained in:
Marcos Casagrande 2020-05-25 18:55:16 +02:00 committed by GitHub
parent aef9f22462
commit 08f74e1f6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 194 additions and 420 deletions

View file

@ -922,6 +922,12 @@ declare const Request: {
new (input: RequestInfo, init?: RequestInit): Request;
};
interface ResponseInit {
headers?: HeadersInit;
status?: number;
statusText?: string;
}
type ResponseType =
| "basic"
| "cors"
@ -945,20 +951,7 @@ interface Response extends Body {
declare const Response: {
prototype: Response;
// TODO(#4667) Response constructor is non-standard.
// new(body?: BodyInit | null, init?: ResponseInit): Response;
new (
url: string,
status: number,
statusText: string,
headersList: Array<[string, string]>,
rid: number,
redirected_: boolean,
type_?: null | ResponseType,
body_?: null | Body
): Response;
new (body?: BodyInit | null, init?: ResponseInit): Response;
error(): Response;
redirect(url: string, status?: number): Response;
};