(status, rawHeaders, resume, statusText)
| 14781 | response.aborted = true; |
| 14782 | if (isReadable(stream)) { |
| 14783 | fetchParams.controller.controller.error( |
| 14784 | fetchParams.controller.serializedAbortReason |
| 14785 | ); |
| 14786 | } |
| 14787 | } else { |
| 14788 | if (isReadable(stream)) { |
| 14789 | fetchParams.controller.controller.error(new TypeError("terminated", { |
| 14790 | cause: isErrorLike(reason) ? reason : void 0 |
| 14791 | })); |
| 14792 | } |
| 14793 | } |
| 14794 | fetchParams.controller.connection.destroy(); |
| 14795 | } |
| 14796 | return response; |
| 14797 | function dispatch({ body }) { |
| 14798 | const url = requestCurrentURL(request); |
| 14799 | const agent = fetchParams.controller.dispatcher; |
| 14800 | return new Promise((resolve2, reject) => agent.dispatch( |
| 14801 | { |
| 14802 | path: url.pathname + url.search, |
| 14803 | origin: url.origin, |
| 14804 | method: request.method, |
| 14805 | body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body, |
| 14806 | headers: request.headersList.entries, |
| 14807 | maxRedirections: 0, |
| 14808 | upgrade: request.mode === "websocket" ? "websocket" : void 0 |
| 14809 | }, |
| 14810 | { |
| 14811 | body: null, |
| 14812 | abort: null, |
| 14813 | onConnect(abort) { |
| 14814 | const { connection } = fetchParams.controller; |
| 14815 | timingInfo.finalConnectionTimingInfo = clampAndCoarsenConnectionTimingInfo(void 0, timingInfo.postRedirectStartTime, fetchParams.crossOriginIsolatedCapability); |
| 14816 | if (connection.destroyed) { |
| 14817 | abort(new DOMException("The operation was aborted.", "AbortError")); |
| 14818 | } else { |
| 14819 | fetchParams.controller.on("terminated", abort); |
| 14820 | this.abort = connection.abort = abort; |
| 14821 | } |
| 14822 | timingInfo.finalNetworkRequestStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); |
| 14823 | }, |
| 14824 | onResponseStarted() { |
| 14825 | timingInfo.finalNetworkResponseStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability); |
| 14826 | }, |
| 14827 | onHeaders(status, rawHeaders, resume, statusText) { |
| 14828 | if (status < 200) { |
| 14829 | return; |
| 14830 | } |
| 14831 | let location = ""; |
| 14832 | const headersList = new HeadersList(); |
| 14833 | for (let i = 0; i < rawHeaders.length; i += 2) { |
| 14834 | headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString("latin1"), true); |
| 14835 | } |
| 14836 | location = headersList.get("location", true); |
| 14837 | this.body = new Readable({ read: resume }); |
| 14838 | const decoders = []; |
| 14839 | const willFollow = location && request.redirect === "follow" && redirectStatusSet.has(status); |
| 14840 | if (request.method !== "HEAD" && request.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) { |
nothing calls this directly
no test coverage detected