(input, options)
| 323 | } |
| 324 | |
| 325 | function Request(input, options) { |
| 326 | options = options || {}; |
| 327 | var body = options.body; |
| 328 | |
| 329 | if (input instanceof Request) { |
| 330 | if (input.bodyUsed) { |
| 331 | throw new TypeError("Already read"); |
| 332 | } |
| 333 | this.url = input.url; |
| 334 | this.credentials = input.credentials; |
| 335 | if (!options.headers) { |
| 336 | this.headers = new Headers(input.headers); |
| 337 | } |
| 338 | this.method = input.method; |
| 339 | this.mode = input.mode; |
| 340 | this.signal = input.signal; |
| 341 | if (!body && input._bodyInit != null) { |
| 342 | body = input._bodyInit; |
| 343 | input.bodyUsed = true; |
| 344 | } |
| 345 | } else { |
| 346 | this.url = String(input); |
| 347 | } |
| 348 | |
| 349 | this.credentials = options.credentials || this.credentials || "same-origin"; |
| 350 | if (options.headers || !this.headers) { |
| 351 | this.headers = new Headers(options.headers); |
| 352 | } |
| 353 | this.method = normalizeMethod(options.method || this.method || "GET"); |
| 354 | this.mode = options.mode || this.mode || null; |
| 355 | this.signal = options.signal || this.signal; |
| 356 | this.referrer = null; |
| 357 | |
| 358 | if ((this.method === "GET" || this.method === "HEAD") && body) { |
| 359 | throw new TypeError("Body not allowed for GET or HEAD requests"); |
| 360 | } |
| 361 | this._initBody(body); |
| 362 | } |
| 363 | |
| 364 | Request.prototype.clone = function () { |
| 365 | return new Request(this, { body: this._bodyInit }); |
nothing calls this directly
no test coverage detected