mirror of
https://github.com/denoland/deno.git
synced 2025-10-01 14:41:15 +00:00
clean up code in cli/js (#6611)
This commit is contained in:
parent
ab4c574f52
commit
158ae0bfe9
89 changed files with 395 additions and 354 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import { notImplemented } from "../util.ts";
|
||||
import { isTypedArray } from "./util.ts";
|
||||
import * as domTypes from "./dom_types.d.ts";
|
||||
|
@ -55,7 +56,6 @@ export class Response extends Body.Body implements domTypes.Response {
|
|||
if (!type) {
|
||||
type = "default";
|
||||
} else {
|
||||
type = type;
|
||||
if (type == "error") {
|
||||
// spec: https://fetch.spec.whatwg.org/#concept-network-error
|
||||
status = 0;
|
||||
|
@ -144,12 +144,11 @@ export class Response extends Body.Body implements domTypes.Response {
|
|||
resBody = tees[1];
|
||||
}
|
||||
|
||||
const cloned = new Response(resBody, {
|
||||
return new Response(resBody, {
|
||||
status: this.status,
|
||||
statusText: this.statusText,
|
||||
headers: new Headers(headersList),
|
||||
});
|
||||
return cloned;
|
||||
}
|
||||
|
||||
static redirect(url: URL | string, status: number): domTypes.Response {
|
||||
|
@ -260,7 +259,7 @@ export async function fetch(
|
|||
}
|
||||
|
||||
let responseBody;
|
||||
let responseInit: ResponseInit = {};
|
||||
let responseInit: domTypes.ResponseInit = {};
|
||||
while (remRedirectCount) {
|
||||
const fetchResponse = await sendFetchReq(url, method, headers, body);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue