- From: Rafael Silva <notifications@github.com>
- Date: Sun, 27 Mar 2022 15:29:55 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/1420@github.com>
The [`Request`](https://fetch.spec.whatwg.org/#request-class) constructor steps are: > The new Request(input, init) constructor steps are: 1. Let request be null. 2. Let fallbackMode be null. 3. Let baseURL be [this](https://webidl.spec.whatwg.org/#this)’s [relevant settings object](https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object)’s [API base URL](https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url). 4. Let signal be null. 5. If input is a string, then: 1. Let parsedURL be the result of [parsing](https://url.spec.whatwg.org/#concept-url-parser) input with baseURL. 2. If parsedURL is failure, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a [TypeError](https://webidl.spec.whatwg.org/#exceptiondef-typeerror). 3. If parsedURL [includes credentials](https://url.spec.whatwg.org/#include-credentials), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a [TypeError](https://webidl.spec.whatwg.org/#exceptiondef-typeerror). 4. **Set [request](https://fetch.spec.whatwg.org/#concept-request) to a new request whose [URL](https://fetch.spec.whatwg.org/#concept-request-url) is parsedURL.** 5. Set fallbackMode to "cors". 6. Otherwise: 1. Assert: input is a [Request](https://fetch.spec.whatwg.org/#request) object. 2. **Set [request](https://fetch.spec.whatwg.org/#concept-request-request) to input’s request.** 3. Set [signal](https://fetch.spec.whatwg.org/#request-signal) to input’s signal. 7. Let origin be [this](https://webidl.spec.whatwg.org/#this)’s [relevant settings object](https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object)’s [origin](https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin). 8. Let [window](https://fetch.spec.whatwg.org/#concept-request-window) be "client". 9. If request’s window is an [environment settings object](https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object) and its [origin](https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin) is [same origin](https://html.spec.whatwg.org/multipage/origin.html#same-origin) with origin, then set [window](https://fetch.spec.whatwg.org/#concept-request-window) to request’s [window](https://fetch.spec.whatwg.org/#dom-requestinit-window). 10. If init["window"] [exists](https://infra.spec.whatwg.org/#map-exists) and is non-null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a [TypeError](https://webidl.spec.whatwg.org/#exceptiondef-typeerror). 11. If init["[window](https://fetch.spec.whatwg.org/#dom-requestinit-window)"] [exists](https://infra.spec.whatwg.org/#map-exists), then set window to "no-window". 12. **Set [request](https://fetch.spec.whatwg.org/#concept-request) to a new request with the following properties:** --- I may be missing something, but, reading those steps seems that any `request` creation before step `12` is overridden. For instance, if the `input` is a string, then a new request is created using `parsedURL`, however, the same request is overridden in step `12`. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/1420 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/issues/1420@github.com>
Received on Sunday, 27 March 2022 22:30:07 UTC