MCPcopy
hub / github.com/di-sukharev/opencommit / httpNetworkFetch

Function httpNetworkFetch

out/cli.cjs:60508–60806  ·  view source on GitHub ↗
(fetchParams, includeCredentials = false, forceNewConnection = false)

Source from the content-addressed store, hash-verified

60506 isAuthenticationFetch,
60507 true
60508 );
60509 }
60510 if (isAuthenticationFetch) {
60511 }
60512 return response;
60513 }
60514 async function httpNetworkFetch(fetchParams, includeCredentials = false, forceNewConnection = false) {
60515 assert2(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed);
60516 fetchParams.controller.connection = {
60517 abort: null,
60518 destroyed: false,
60519 destroy(err) {
60520 if (!this.destroyed) {
60521 this.destroyed = true;
60522 this.abort?.(err ?? new DOMException3("The operation was aborted.", "AbortError"));
60523 }
60524 }
60525 };
60526 const request3 = fetchParams.request;
60527 let response = null;
60528 const timingInfo = fetchParams.timingInfo;
60529 const httpCache = null;
60530 if (httpCache == null) {
60531 request3.cache = "no-store";
60532 }
60533 const newConnection = forceNewConnection ? "yes" : "no";
60534 if (request3.mode === "websocket") {
60535 } else {
60536 }
60537 let requestBody = null;
60538 if (request3.body == null && fetchParams.processRequestEndOfBody) {
60539 queueMicrotask(() => fetchParams.processRequestEndOfBody());
60540 } else if (request3.body != null) {
60541 const processBodyChunk = async function* (bytes) {
60542 if (isCancelled(fetchParams)) {
60543 return;
60544 }
60545 yield bytes;
60546 fetchParams.processRequestBodyChunkLength?.(bytes.byteLength);
60547 };
60548 const processEndOfBody = () => {
60549 if (isCancelled(fetchParams)) {
60550 return;
60551 }
60552 if (fetchParams.processRequestEndOfBody) {
60553 fetchParams.processRequestEndOfBody();
60554 }
60555 };
60556 const processBodyError = (e3) => {
60557 if (isCancelled(fetchParams)) {
60558 return;
60559 }
60560 if (e3.name === "AbortError") {
60561 fetchParams.controller.abort();
60562 } else {
60563 fetchParams.controller.terminate(e3);
60564 }
60565 };

Callers 1

httpNetworkOrCacheFetchFunction · 0.85

Calls 15

isCancelledFunction · 0.85
processEndOfBodyFunction · 0.85
processBodyErrorFunction · 0.85
dispatchFunction · 0.85
makeResponseFunction · 0.85
makeNetworkErrorFunction · 0.85
isAbortedFunction · 0.85
readableStreamCloseFunction · 0.85
finalizeResponseFunction · 0.85
isErroredFunction · 0.85
nextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…