(input, init = {})
| 13156 | var Request = class _Request { |
| 13157 | // https://fetch.spec.whatwg.org/#dom-request |
| 13158 | constructor(input, init = {}) { |
| 13159 | var _a, _b, _c; |
| 13160 | webidl.util.markAsUncloneable(this); |
| 13161 | if (input === kConstruct) { |
| 13162 | return; |
| 13163 | } |
| 13164 | const prefix = "Request constructor"; |
| 13165 | webidl.argumentLengthCheck(arguments, 1, prefix); |
| 13166 | input = webidl.converters.RequestInfo(input, prefix, "input"); |
| 13167 | init = webidl.converters.RequestInit(init, prefix, "init"); |
| 13168 | let request = null; |
| 13169 | let fallbackMode = null; |
| 13170 | const baseUrl = environmentSettingsObject.settingsObject.baseUrl; |
| 13171 | let signal = null; |
| 13172 | if (typeof input === "string") { |
| 13173 | this[kDispatcher] = init.dispatcher; |
| 13174 | let parsedURL; |
| 13175 | try { |
| 13176 | parsedURL = new URL(input, baseUrl); |
| 13177 | } catch (err) { |
| 13178 | throw new TypeError("Failed to parse URL from " + input, { cause: err }); |
| 13179 | } |
| 13180 | if (parsedURL.username || parsedURL.password) { |
| 13181 | throw new TypeError( |
| 13182 | "Request cannot be constructed from a URL that includes credentials: " + input |
| 13183 | ); |
| 13184 | } |
| 13185 | request = makeRequest({ urlList: [parsedURL] }); |
| 13186 | fallbackMode = "cors"; |
| 13187 | } else { |
| 13188 | this[kDispatcher] = init.dispatcher || input[kDispatcher]; |
| 13189 | assert(input instanceof _Request); |
| 13190 | request = input[kState]; |
| 13191 | signal = input[kSignal]; |
| 13192 | } |
| 13193 | const origin = environmentSettingsObject.settingsObject.origin; |
| 13194 | let window = "client"; |
| 13195 | if (((_b = (_a = request.window) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name) === "EnvironmentSettingsObject" && sameOrigin(request.window, origin)) { |
| 13196 | window = request.window; |
| 13197 | } |
| 13198 | if (init.window != null) { |
| 13199 | throw new TypeError(`'window' option '${window}' must be null`); |
| 13200 | } |
| 13201 | if ("window" in init) { |
| 13202 | window = "no-window"; |
| 13203 | } |
| 13204 | request = makeRequest({ |
| 13205 | // URL request’s URL. |
| 13206 | // undici implementation note: this is set as the first item in request's urlList in makeRequest |
| 13207 | // method request’s method. |
| 13208 | method: request.method, |
| 13209 | // header list A copy of request’s header list. |
| 13210 | // undici implementation note: headersList is cloned in makeRequest |
| 13211 | headersList: request.headersList, |
| 13212 | // unsafe-request flag Set. |
| 13213 | unsafeRequest: request.unsafeRequest, |
| 13214 | // client This’s relevant settings object. |
| 13215 | client: environmentSettingsObject.settingsObject, |
nothing calls this directly
no test coverage detected