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

Method onResponseStart

deps/undici/src/lib/core/request.js:328–351  ·  view source on GitHub ↗
(statusCode, headers, resume, statusText)

Source from the content-addressed store, hash-verified

326 }
327
328 onResponseStart (statusCode, headers, resume, statusText) {
329 assert(!this.aborted)
330 assert(!this.completed)
331
332 if (channels.headers.hasSubscribers) {
333 channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
334 }
335
336 const controller = this[kController]
337 if (controller) {
338 controller[kResume] = resume
339 controller.rawHeaders = headers
340 }
341
342 const parsedHeaders = Array.isArray(headers) ? parseHeaders(headers) : headers
343
344 try {
345 this[kHandler].onResponseStart?.(controller, statusCode, parsedHeaders, statusText)
346 return !controller?.paused
347 } catch (err) {
348 this.abort(err)
349 return false
350 }
351 }
352
353 onResponseData (chunk) {
354 assert(!this.aborted)

Callers

nothing calls this directly

Calls 5

parseHeadersFunction · 0.70
onResponseStartMethod · 0.65
abortMethod · 0.65
assertFunction · 0.50
publishMethod · 0.45

Tested by

no test coverage detected