diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2019-08-17 07:20:04 +0900 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-16 18:20:04 -0400 |
commit | 9aa9aafbab934b483977683e1ee430abb277833f (patch) | |
tree | 61c14f8ee74a00416e83e075897cd33c927bee39 /js/fetch.ts | |
parent | 81f809f2a675ff4ff7f93231ca87a18cb5b4628e (diff) |
fix: set response.url (#2782)
Diffstat (limited to 'js/fetch.ts')
-rw-r--r-- | js/fetch.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/js/fetch.ts b/js/fetch.ts index 9853b2194..3911c63d0 100644 --- a/js/fetch.ts +++ b/js/fetch.ts @@ -244,7 +244,6 @@ class Body implements domTypes.Body, domTypes.ReadableStream, io.ReadCloser { } export class Response implements domTypes.Response { - readonly url: string = ""; statusText = "FIXME"; // TODO readonly type = "basic"; // TODO readonly redirected: boolean; @@ -254,6 +253,7 @@ export class Response implements domTypes.Response { readonly body: Body; constructor( + readonly url: string, readonly status: number, headersList: Array<[string, string]>, rid: number, @@ -312,6 +312,7 @@ export class Response implements domTypes.Response { } return new Response( + this.url, this.status, headersList, -1, @@ -458,7 +459,13 @@ export async function fetch( const headersList = deserializeHeaderFields(header); - const response = new Response(status, headersList, bodyRid, redirected); + const response = new Response( + url, + status, + headersList, + bodyRid, + redirected + ); if ([301, 302, 303, 307, 308].includes(response.status)) { // We're in a redirect status switch ((init && init.redirect) || "follow") { |