MCPcopy Index your code
hub / github.com/nodejs/node / sendTrailers

Method sendTrailers

lib/internal/http2/core.js:2381–2405  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

2379 }
2380
2381 sendTrailers(headers) {
2382 if (this.destroyed || this.closed)
2383 throw new ERR_HTTP2_INVALID_STREAM();
2384 if (this[kSentTrailers])
2385 throw new ERR_HTTP2_TRAILERS_ALREADY_SENT();
2386 if (!this[kState].trailersReady)
2387 throw new ERR_HTTP2_TRAILERS_NOT_READY();
2388
2389 assertIsObject(headers, 'headers');
2390 headers = ObjectAssign({ __proto__: null }, headers);
2391
2392 debugStreamObj(this, 'sending trailers');
2393
2394 this[kUpdateTimer]();
2395
2396 const headersList = buildNgHeaderString(
2397 headers,
2398 assertValidPseudoHeaderTrailer,
2399 this.session[kStrictSingleValueFields],
2400 );
2401 this[kSentTrailers] = headers;
2402
2403 // Send the trailers in setImmediate so we don't do it on nghttp2 stack.
2404 setImmediate(finishSendTrailers, this, headersList);
2405 }
2406
2407 get closed() {
2408 return !!(this[kState].flags & STREAM_FLAGS_CLOSED);

Callers 2

onStreamTrailersReadyFunction · 0.45
onStreamTrailersFunction · 0.45

Calls 4

ObjectAssignFunction · 0.85
debugStreamObjFunction · 0.85
buildNgHeaderStringFunction · 0.85
setImmediateFunction · 0.50

Tested by

no test coverage detected