summaryrefslogtreecommitdiff
path: root/cli/js/web/fetch.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2020-07-14 15:24:17 -0400
committerGitHub <noreply@github.com>2020-07-14 15:24:17 -0400
commitcde4dbb35132848ffece59ef9cfaccff32347124 (patch)
treecc7830968c6decde704c8cfb83c9185193dc698f /cli/js/web/fetch.ts
parent9eca71caa1674c31f9cc5d4e86c03f10b59e0a00 (diff)
Use dprint for internal formatting (#6682)
Diffstat (limited to 'cli/js/web/fetch.ts')
-rw-r--r--cli/js/web/fetch.ts22
1 files changed, 10 insertions, 12 deletions
diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts
index d692b83e1..4fe525cde 100644
--- a/cli/js/web/fetch.ts
+++ b/cli/js/web/fetch.ts
@@ -38,14 +38,13 @@ export class Response extends Body.Body implements domTypes.Response {
let status = init.status === undefined ? 200 : Number(init.status || 0);
let statusText = init.statusText ?? "";
- let headers =
- init.headers instanceof Headers
- ? init.headers
- : new Headers(init.headers);
+ let headers = init.headers instanceof Headers
+ ? init.headers
+ : new Headers(init.headers);
if (init.status !== undefined && (status < 200 || status > 599)) {
throw new RangeError(
- `The status provided (${init.status}) is outside the range [200, 599]`
+ `The status provided (${init.status}) is outside the range [200, 599]`,
);
}
@@ -156,7 +155,7 @@ export class Response extends Body.Body implements domTypes.Response {
static redirect(url: URL | string, status: number): domTypes.Response {
if (![301, 302, 303, 307, 308].includes(status)) {
throw new RangeError(
- "The redirection status must be one of 301, 302, 303, 307 and 308."
+ "The redirection status must be one of 301, 302, 303, 307 and 308.",
);
}
return new Response(null, {
@@ -171,7 +170,7 @@ function sendFetchReq(
url: string,
method: string | null,
headers: Headers | null,
- body: ArrayBufferView | undefined
+ body: ArrayBufferView | undefined,
): Promise<FetchResponse> {
let headerArray: Array<[string, string]> = [];
if (headers) {
@@ -189,7 +188,7 @@ function sendFetchReq(
export async function fetch(
input: (domTypes.Request & { _bodySource?: unknown }) | URL | string,
- init?: domTypes.RequestInit
+ init?: domTypes.RequestInit,
): Promise<Response> {
let url: string;
let method: string | null = null;
@@ -203,10 +202,9 @@ export async function fetch(
if (init != null) {
method = init.method || null;
if (init.headers) {
- headers =
- init.headers instanceof Headers
- ? init.headers
- : new Headers(init.headers);
+ headers = init.headers instanceof Headers
+ ? init.headers
+ : new Headers(init.headers);
} else {
headers = null;
}