(input, init = void 0)
| 12504 | #abortCleanup = null; |
| 12505 | // https://fetch.spec.whatwg.org/#dom-request |
| 12506 | constructor(input, init = void 0) { |
| 12507 | webidl.util.markAsUncloneable(this); |
| 12508 | if (input === kConstruct) { |
| 12509 | return; |
| 12510 | } |
| 12511 | const prefix = "Request constructor"; |
| 12512 | webidl.argumentLengthCheck(arguments, 1, prefix); |
| 12513 | input = webidl.converters.RequestInfo(input); |
| 12514 | init = webidl.converters.RequestInit(init); |
| 12515 | let request = null; |
| 12516 | let fallbackMode = null; |
| 12517 | const baseUrl = environmentSettingsObject.settingsObject.baseUrl; |
| 12518 | let signal = null; |
| 12519 | if (typeof input === "string") { |
| 12520 | this.#dispatcher = init.dispatcher; |
| 12521 | let parsedURL; |
| 12522 | try { |
| 12523 | parsedURL = new URL(input, baseUrl); |
| 12524 | } catch (err) { |
| 12525 | throw new TypeError("Failed to parse URL from " + input, { cause: err }); |
| 12526 | } |
| 12527 | if (parsedURL.username || parsedURL.password) { |
| 12528 | throw new TypeError( |
| 12529 | "Request cannot be constructed from a URL that includes credentials: " + input |
| 12530 | ); |
| 12531 | } |
| 12532 | request = makeRequest({ urlList: [parsedURL] }); |
| 12533 | fallbackMode = "cors"; |
| 12534 | } else { |
| 12535 | assert(webidl.is.Request(input)); |
| 12536 | request = input.#state; |
| 12537 | signal = input.#signal; |
| 12538 | this.#dispatcher = init.dispatcher || input.#dispatcher; |
| 12539 | } |
| 12540 | const origin = environmentSettingsObject.settingsObject.origin; |
| 12541 | let window = "client"; |
| 12542 | if (request.window?.constructor?.name === "EnvironmentSettingsObject" && sameOrigin(request.window, origin)) { |
| 12543 | window = request.window; |
| 12544 | } |
| 12545 | if (init.window != null) { |
| 12546 | throw new TypeError(`'window' option '${window}' must be null`); |
| 12547 | } |
| 12548 | if ("window" in init) { |
| 12549 | window = "no-window"; |
| 12550 | } |
| 12551 | request = makeRequest({ |
| 12552 | // URL request?s URL. |
| 12553 | // undici implementation note: this is set as the first item in request's urlList in makeRequest |
| 12554 | // method request?s method. |
| 12555 | method: request.method, |
| 12556 | // header list A copy of request?s header list. |
| 12557 | // undici implementation note: headersList is cloned in makeRequest |
| 12558 | headersList: request.headersList, |
| 12559 | // unsafe-request flag Set. |
| 12560 | unsafeRequest: request.unsafeRequest, |
| 12561 | // client This?s relevant settings object. |
| 12562 | client: environmentSettingsObject.settingsObject, |
| 12563 | // window window. |
nothing calls this directly
no test coverage detected