(response, init, body)
| 59045 | } else { |
| 59046 | assert2(false); |
| 59047 | } |
| 59048 | } |
| 59049 | function makeAppropriateNetworkError(fetchParams, err = null) { |
| 59050 | assert2(isCancelled(fetchParams)); |
| 59051 | return isAborted(fetchParams) ? makeNetworkError(Object.assign(new DOMException3("The operation was aborted.", "AbortError"), { cause: err })) : makeNetworkError(Object.assign(new DOMException3("Request was cancelled."), { cause: err })); |
| 59052 | } |
| 59053 | function initializeResponse(response, init, body) { |
| 59054 | if (init.status !== null && (init.status < 200 || init.status > 599)) { |
| 59055 | throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.'); |
| 59056 | } |
| 59057 | if ("statusText" in init && init.statusText != null) { |
| 59058 | if (!isValidReasonPhrase(String(init.statusText))) { |
| 59059 | throw new TypeError("Invalid statusText"); |
| 59060 | } |
| 59061 | } |
| 59062 | if ("status" in init && init.status != null) { |
| 59063 | response[kState].status = init.status; |
| 59064 | } |
| 59065 | if ("statusText" in init && init.statusText != null) { |
| 59066 | response[kState].statusText = init.statusText; |
| 59067 | } |
| 59068 | if ("headers" in init && init.headers != null) { |
| 59069 | fill(response[kHeaders], init.headers); |
| 59070 | } |
| 59071 | if (body) { |
| 59072 | if (nullBodyStatus.includes(response.status)) { |
| 59073 | throw webidl.errors.exception({ |
| 59074 | header: "Response constructor", |
| 59075 | message: "Invalid response status code " + response.status |
| 59076 | }); |
| 59077 | } |
| 59078 | response[kState].body = body.body; |
| 59079 | if (body.type != null && !response[kState].headersList.contains("Content-Type")) { |
| 59080 | response[kState].headersList.append("content-type", body.type); |
no test coverage detected
searching dependent graphs…