MCPcopy Create free account
hub / github.com/angular/dev-infra / fetchFinale

Function fetchFinale

github-actions/saucelabs/set-saucelabs-env.js:14278–14334  ·  view source on GitHub ↗
(fetchParams, response)

Source from the content-addressed store, hash-verified

14276 }
14277 }
14278 function fetchFinale(fetchParams, response) {
14279 var _a;
14280 let timingInfo = fetchParams.timingInfo;
14281 const processResponseEndOfBody = () => {
14282 const unsafeEndTime = Date.now();
14283 if (fetchParams.request.destination === "document") {
14284 fetchParams.controller.fullTimingInfo = timingInfo;
14285 }
14286 fetchParams.controller.reportTimingSteps = () => {
14287 if (fetchParams.request.url.protocol !== "https:") {
14288 return;
14289 }
14290 timingInfo.endTime = unsafeEndTime;
14291 let cacheState = response.cacheState;
14292 const bodyInfo = response.bodyInfo;
14293 if (!response.timingAllowPassed) {
14294 timingInfo = createOpaqueTimingInfo(timingInfo);
14295 cacheState = "";
14296 }
14297 let responseStatus = 0;
14298 if (fetchParams.request.mode !== "navigator" || !response.hasCrossOriginRedirects) {
14299 responseStatus = response.status;
14300 const mimeType = extractMimeType(response.headersList);
14301 if (mimeType !== "failure") {
14302 bodyInfo.contentType = minimizeSupportedMimeType(mimeType);
14303 }
14304 }
14305 if (fetchParams.request.initiatorType != null) {
14306 markResourceTiming(timingInfo, fetchParams.request.url.href, fetchParams.request.initiatorType, globalThis, cacheState, bodyInfo, responseStatus);
14307 }
14308 };
14309 const processResponseEndOfBodyTask = () => {
14310 fetchParams.request.done = true;
14311 if (fetchParams.processResponseEndOfBody != null) {
14312 queueMicrotask(() => fetchParams.processResponseEndOfBody(response));
14313 }
14314 if (fetchParams.request.initiatorType != null) {
14315 fetchParams.controller.reportTimingSteps();
14316 }
14317 };
14318 queueMicrotask(() => processResponseEndOfBodyTask());
14319 };
14320 if (fetchParams.processResponse != null) {
14321 queueMicrotask(() => {
14322 fetchParams.processResponse(response);
14323 fetchParams.processResponse = null;
14324 });
14325 }
14326 const internalResponse = response.type === "error" ? response : (_a = response.internalResponse) != null ? _a : response;
14327 if (internalResponse.body == null) {
14328 processResponseEndOfBody();
14329 } else {
14330 finished(internalResponse.body.stream, () => {
14331 processResponseEndOfBody();
14332 });
14333 }
14334 }
14335 function httpFetch(fetchParams) {

Callers 3

processBodyErrorFunction · 0.70
processBodyFunction · 0.70
mainFetchFunction · 0.70

Calls 2

processResponseEndOfBodyFunction · 0.70
processResponseMethod · 0.45

Tested by

no test coverage detected