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

Function httpNetworkFetch

github-actions/saucelabs/set-saucelabs-env.js:14562–14891  ·  view source on GitHub ↗
(fetchParams, includeCredentials = false, forceNewConnection = false)

Source from the content-addressed store, hash-verified

14560 includeCredentials,
14561 isNewConnectionFetch
14562 );
14563 if (!safeMethodsSet.has(httpRequest.method) && forwardResponse.status >= 200 && forwardResponse.status <= 399) {
14564 }
14565 if (revalidatingFlag && forwardResponse.status === 304) {
14566 }
14567 if (response == null) {
14568 response = forwardResponse;
14569 }
14570 }
14571 response.urlList = [...httpRequest.urlList];
14572 if (httpRequest.headersList.contains("range", true)) {
14573 response.rangeRequested = true;
14574 }
14575 response.requestIncludesCredentials = includeCredentials;
14576 if (response.status === 407) {
14577 if (request.window === "no-window") {
14578 return makeNetworkError();
14579 }
14580 if (isCancelled(fetchParams)) {
14581 return makeAppropriateNetworkError(fetchParams);
14582 }
14583 return makeNetworkError("proxy authentication required");
14584 }
14585 if (
14586 // response’s status is 421
14587 response.status === 421 && // isNewConnectionFetch is false
14588 !isNewConnectionFetch && // request’s body is null, or request’s body is non-null and request’s body’s source is non-null
14589 (request.body == null || request.body.source != null)
14590 ) {
14591 if (isCancelled(fetchParams)) {
14592 return makeAppropriateNetworkError(fetchParams);
14593 }
14594 fetchParams.controller.connection.destroy();
14595 response = yield httpNetworkOrCacheFetch(
14596 fetchParams,
14597 isAuthenticationFetch,
14598 true
14599 );
14600 }
14601 if (isAuthenticationFetch) {
14602 }
14603 return response;
14604 });
14605 }
14606 function httpNetworkFetch(fetchParams, includeCredentials = false, forceNewConnection = false) {
14607 return __async(this, null, function* () {
14608 assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed);
14609 fetchParams.controller.connection = {
14610 abort: null,
14611 destroyed: false,
14612 destroy(err, abort = true) {
14613 var _a2;
14614 if (!this.destroyed) {
14615 this.destroyed = true;
14616 if (abort) {
14617 (_a2 = this.abort) == null ? void 0 : _a2.call(this, err != null ? err : new DOMException("The operation was aborted.", "AbortError"));
14618 }
14619 }

Callers 1

httpNetworkOrCacheFetchFunction · 0.70

Calls 15

__asyncFunction · 0.70
__asyncGeneratorFunction · 0.70
__forAwaitFunction · 0.70
__yieldStarFunction · 0.70
processBodyChunkFunction · 0.70
processEndOfBodyFunction · 0.70
processBodyErrorFunction · 0.70
dispatchFunction · 0.70
makeResponseFunction · 0.70
makeNetworkErrorFunction · 0.70
isAbortedFunction · 0.70

Tested by

no test coverage detected