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

Function onHeaders

github-actions/browserstack/set-browserstack-env.js:14783–14843  ·  view source on GitHub ↗
(status, rawHeaders, resume, statusText)

Source from the content-addressed store, hash-verified

14781 }
14782 timingInfo.decodedBodySize += (_a2 = bytes == null ? void 0 : bytes.byteLength) != null ? _a2 : 0;
14783 if (isFailure) {
14784 fetchParams.controller.terminate(bytes);
14785 return;
14786 }
14787 const buffer = new Uint8Array(bytes);
14788 if (buffer.byteLength) {
14789 fetchParams.controller.controller.enqueue(buffer);
14790 }
14791 if (isErrored(stream)) {
14792 fetchParams.controller.terminate();
14793 return;
14794 }
14795 if (fetchParams.controller.controller.desiredSize <= 0) {
14796 return;
14797 }
14798 }
14799 });
14800 function onAborted(reason) {
14801 if (isAborted(fetchParams)) {
14802 response.aborted = true;
14803 if (isReadable(stream)) {
14804 fetchParams.controller.controller.error(
14805 fetchParams.controller.serializedAbortReason
14806 );
14807 }
14808 } else {
14809 if (isReadable(stream)) {
14810 fetchParams.controller.controller.error(new TypeError("terminated", {
14811 cause: isErrorLike(reason) ? reason : void 0
14812 }));
14813 }
14814 }
14815 fetchParams.controller.connection.destroy();
14816 }
14817 return response;
14818 function dispatch({ body }) {
14819 const url = requestCurrentURL(request);
14820 const agent = fetchParams.controller.dispatcher;
14821 return new Promise((resolve2, reject) => agent.dispatch(
14822 {
14823 path: url.pathname + url.search,
14824 origin: url.origin,
14825 method: request.method,
14826 body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
14827 headers: request.headersList.entries,
14828 maxRedirections: 0,
14829 upgrade: request.mode === "websocket" ? "websocket" : void 0
14830 },
14831 {
14832 body: null,
14833 abort: null,
14834 onConnect(abort) {
14835 const { connection } = fetchParams.controller;
14836 timingInfo.finalConnectionTimingInfo = clampAndCoarsenConnectionTimingInfo(void 0, timingInfo.postRedirectStartTime, fetchParams.crossOriginIsolatedCapability);
14837 if (connection.destroyed) {
14838 abort(new DOMException("The operation was aborted.", "AbortError"));
14839 } else {
14840 fetchParams.controller.on("terminated", abort);

Callers

nothing calls this directly

Calls 10

createInflateFunction · 0.70
pipelineFunction · 0.70
appendMethod · 0.45
toStringMethod · 0.45
getMethod · 0.45
hasMethod · 0.45
pushMethod · 0.45
onMethod · 0.45
onErrorMethod · 0.45

Tested by

no test coverage detected