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

Function httpNetworkFetch

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

Source from the content-addressed store, hash-verified

14560 });
14561 }
14562 function httpNetworkFetch(fetchParams, includeCredentials = false, forceNewConnection = false) {
14563 return __async(this, null, function* () {
14564 assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed);
14565 fetchParams.controller.connection = {
14566 abort: null,
14567 destroyed: false,
14568 destroy(err, abort = true) {
14569 var _a2;
14570 if (!this.destroyed) {
14571 this.destroyed = true;
14572 if (abort) {
14573 (_a2 = this.abort) == null ? void 0 : _a2.call(this, err != null ? err : new DOMException("The operation was aborted.", "AbortError"));
14574 }
14575 }
14576 }
14577 };
14578 const request = fetchParams.request;
14579 let response = null;
14580 const timingInfo = fetchParams.timingInfo;
14581 const httpCache = null;
14582 if (httpCache == null) {
14583 request.cache = "no-store";
14584 }
14585 const newConnection = forceNewConnection ? "yes" : "no";
14586 if (request.mode === "websocket") {
14587 } else {
14588 }
14589 let requestBody = null;
14590 if (request.body == null && fetchParams.processRequestEndOfBody) {
14591 queueMicrotask(() => fetchParams.processRequestEndOfBody());
14592 } else if (request.body != null) {
14593 const processBodyChunk = function(bytes) {
14594 return __asyncGenerator(this, null, function* () {
14595 var _a2;
14596 if (isCancelled(fetchParams)) {
14597 return;
14598 }
14599 yield bytes;
14600 (_a2 = fetchParams.processRequestBodyChunkLength) == null ? void 0 : _a2.call(fetchParams, bytes.byteLength);
14601 });
14602 };
14603 const processEndOfBody = () => {
14604 if (isCancelled(fetchParams)) {
14605 return;
14606 }
14607 if (fetchParams.processRequestEndOfBody) {
14608 fetchParams.processRequestEndOfBody();
14609 }
14610 };
14611 const processBodyError = (e) => {
14612 if (isCancelled(fetchParams)) {
14613 return;
14614 }
14615 if (e.name === "AbortError") {
14616 fetchParams.controller.abort();
14617 } else {
14618 fetchParams.controller.terminate(e);
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