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

Method onResponseEnd

deps/undici/undici.js:3000–3018  ·  view source on GitHub ↗
(trailers)

Source from the content-addressed store, hash-verified

2998 return this[kHandler].onRequestUpgrade?.(controller, statusCode, parsedHeaders, socket);
2999 }
3000 onResponseEnd(trailers) {
3001 this.onFinally();
3002 assert(!this.aborted);
3003 assert(!this.completed);
3004 this.completed = true;
3005 if (channels.trailers.hasSubscribers) {
3006 channels.trailers.publish({ request: this, trailers });
3007 }
3008 const controller = this[kController];
3009 if (controller) {
3010 controller.rawTrailers = trailers;
3011 }
3012 const parsedTrailers = Array.isArray(trailers) ? parseHeaders(trailers) : trailers;
3013 try {
3014 return this[kHandler].onResponseEnd?.(controller, parsedTrailers);
3015 } catch (err) {
3016 this.onResponseError(err);
3017 }
3018 }
3019 onResponseError(error) {
3020 this.onFinally();
3021 if (channels.error.hasSubscribers) {

Callers

nothing calls this directly

Calls 12

parseHeadersFunction · 0.70
toRawHeadersFunction · 0.70
removeSignalFunction · 0.70
onResponseEndMethod · 0.65
onResponseErrorMethod · 0.65
keysMethod · 0.65
assertFunction · 0.50
onFinallyMethod · 0.45
publishMethod · 0.45
definePropertyMethod · 0.45
pushMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected