({
request,
processRequestBodyChunkLength,
processRequestEndOfBody,
processResponse,
processResponseEndOfBody,
processResponseConsumeBody,
useParallelQueue = false,
dispatcher = getGlobalDispatcher()
// undici
})
| 14013 | processResponseEndOfBody: handleFetchDone, |
| 14014 | processResponse, |
| 14015 | dispatcher: requestObject[kDispatcher] |
| 14016 | // undici |
| 14017 | }); |
| 14018 | return p.promise; |
| 14019 | } |
| 14020 | function finalizeAndReportTiming(response, initiatorType = "other") { |
| 14021 | var _a; |
| 14022 | if (response.type === "error" && response.aborted) { |
| 14023 | return; |
| 14024 | } |
| 14025 | if (!((_a = response.urlList) == null ? void 0 : _a.length)) { |
| 14026 | return; |
| 14027 | } |
| 14028 | const originalURL = response.urlList[0]; |
| 14029 | let timingInfo = response.timingInfo; |
| 14030 | let cacheState = response.cacheState; |
| 14031 | if (!urlIsHttpHttpsScheme(originalURL)) { |
| 14032 | return; |
| 14033 | } |
| 14034 | if (timingInfo === null) { |
| 14035 | return; |
| 14036 | } |
| 14037 | if (!response.timingAllowPassed) { |
| 14038 | timingInfo = createOpaqueTimingInfo({ |
| 14039 | startTime: timingInfo.startTime |
| 14040 | }); |
| 14041 | cacheState = ""; |
| 14042 | } |
| 14043 | timingInfo.endTime = coarsenedSharedCurrentTime(); |
| 14044 | response.timingInfo = timingInfo; |
| 14045 | markResourceTiming( |
| 14046 | timingInfo, |
| 14047 | originalURL.href, |
| 14048 | initiatorType, |
| 14049 | globalThis, |
| 14050 | cacheState |
| 14051 | ); |
| 14052 | } |
| 14053 | var markResourceTiming = performance.markResourceTiming; |
| 14054 | function abortFetch(p, request, responseObject, error) { |
| 14055 | var _a, _b; |
| 14056 | if (p) { |
| 14057 | p.reject(error); |
| 14058 | } |
| 14059 | if (request.body != null && isReadable((_a = request.body) == null ? void 0 : _a.stream)) { |
| 14060 | request.body.stream.cancel(error).catch((err) => { |
| 14061 | if (err.code === "ERR_INVALID_STATE") { |
| 14062 | return; |
| 14063 | } |
| 14064 | throw err; |
| 14065 | }); |
| 14066 | } |
| 14067 | if (responseObject == null) { |
| 14068 | return; |
| 14069 | } |
| 14070 | const response = responseObject[kState]; |
| 14071 | if (response.body != null && isReadable((_b = response.body) == null ? void 0 : _b.stream)) { |
| 14072 | response.body.stream.cancel(error).catch((err) => { |
no test coverage detected