MCPcopy Create free account
hub / github.com/nodejs/node / onResponse

Function onResponse

deps/undici/undici.js:9156–9174  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

9154 }
9155 __name(onData, "onData");
9156 function onResponse(headers) {
9157 const stream = this;
9158 const state = stream[kRequestStreamState];
9159 const { request } = state;
9160 stream.off("response", onResponse);
9161 const statusCode = headers[HTTP2_HEADER_STATUS];
9162 delete headers[HTTP2_HEADER_STATUS];
9163 request.onResponseStarted();
9164 state.responseReceived = true;
9165 stream.setTimeout(state.bodyTimeout);
9166 if (request.aborted) {
9167 releaseRequestStream(stream);
9168 return;
9169 }
9170 if (request.onResponseStart(Number(statusCode), headers, stream.resume.bind(stream), "") === false) {
9171 stream.pause();
9172 }
9173 stream.on("data", onData);
9174 }
9175 __name(onResponse, "onResponse");
9176 function onEnd() {
9177 const stream = this;

Callers

nothing calls this directly

Calls 8

releaseRequestStreamFunction · 0.70
onResponseStartedMethod · 0.65
onResponseStartMethod · 0.65
pauseMethod · 0.65
offMethod · 0.45
setTimeoutMethod · 0.45
bindMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected