diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-09-26 23:46:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 23:46:56 +0200 |
commit | 34a15545c979299b00c013e6634dfc3a79011b92 (patch) | |
tree | 4240283a5ee1e136315186a989b219a7a207e1a8 /ext/fetch/23_response.js | |
parent | 5788f2e0829a80fe3ef96c177c80be89a9d155c3 (diff) |
refactor(fetch/response): inline defaultInnerResponse (#12235)
Not useful to have the defaults externally defined when they're only used in `newInnerResponse()`. Also match order in `newInnerResponse()` and `cloneInnerResponse`
Diffstat (limited to 'ext/fetch/23_response.js')
-rw-r--r-- | ext/fetch/23_response.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js index 61e1de151..13710881f 100644 --- a/ext/fetch/23_response.js +++ b/ext/fetch/23_response.js @@ -101,37 +101,33 @@ type: response.type, body, headerList, - url() { - if (this.urlList.length == 0) return null; - return this.urlList[this.urlList.length - 1]; - }, urlList, status: response.status, statusMessage: response.statusMessage, aborted: response.aborted, + url() { + if (this.urlList.length == 0) return null; + return this.urlList[this.urlList.length - 1]; + }, }; } - const defaultInnerResponse = { - type: "default", - body: null, - aborted: false, - url() { - if (this.urlList.length == 0) return null; - return this.urlList[this.urlList.length - 1]; - }, - }; - /** * @returns {InnerResponse} */ function newInnerResponse(status = 200, statusMessage = "") { return { + type: "default", + body: null, headerList: [], urlList: [], status, statusMessage, - ...defaultInnerResponse, + aborted: false, + url() { + if (this.urlList.length == 0) return null; + return this.urlList[this.urlList.length - 1]; + }, }; } |