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

Method onResponseEnd

deps/undici/src/lib/core/request.js:385–409  ·  view source on GitHub ↗
(trailers)

Source from the content-addressed store, hash-verified

383 }
384
385 onResponseEnd (trailers) {
386 this.onFinally()
387
388 assert(!this.aborted)
389 assert(!this.completed)
390
391 this.completed = true
392 if (channels.trailers.hasSubscribers) {
393 channels.trailers.publish({ request: this, trailers })
394 }
395
396 const controller = this[kController]
397 if (controller) {
398 controller.rawTrailers = trailers
399 }
400
401 const parsedTrailers = Array.isArray(trailers) ? parseHeaders(trailers) : trailers
402
403 try {
404 return this[kHandler].onResponseEnd?.(controller, parsedTrailers)
405 } catch (err) {
406 // TODO (fix): This might be a bad idea?
407 this.onResponseError(err)
408 }
409 }
410
411 onResponseError (error) {
412 this.onFinally()

Callers

nothing calls this directly

Calls 6

onFinallyMethod · 0.95
onResponseErrorMethod · 0.95
parseHeadersFunction · 0.70
onResponseEndMethod · 0.65
assertFunction · 0.50
publishMethod · 0.45

Tested by

no test coverage detected