(headers)
| 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); |
no test coverage detected