'trailers' 事件
headers
<HTTP/2 Headers Object> 描述标头的对象flags
<number> 相关的数字标志
当接收到与尾随标头字段关联的标头块时,则会触发 'trailers'
事件。
监听器回调传入 HTTP/2 标头对象和与标头关联的标志。
如果在收到预告片之前调用 http2stream.end()
并且未读取或监听传入数据,则可能不会触发此事件。
stream.on('trailers', (headers, flags) => {
console.log(headers);
});
headers
<HTTP/2 Headers Object> An object describing the headersflags
<number> The associated numeric flags
The 'trailers'
event is emitted when a block of headers associated with
trailing header fields is received. The listener callback is passed the
HTTP/2 Headers Object and flags associated with the headers.
This event might not be emitted if http2stream.end()
is called
before trailers are received and the incoming data is not being read or
listened for.
stream.on('trailers', (headers, flags) => {
console.log(headers);
});