事件:'trailers'
🌐 Event: 'trailers'
headers<HTTP/2 Headers Object> 描述头部的对象flags<number> 相关的数字标志rawHeadersHTTP/2 Raw Headers
'trailers' 事件在接收到与尾随头字段关联的头块时触发。监听器回调会传入 HTTP/2 头对象、与头关联的标志,以及原始格式的头(见 HTTP/2 原始头)。
🌐 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, flags associated
with the headers, and the headers in raw format (see HTTP/2 Raw Headers).
如果在接收到尾部信息之前调用了 http2stream.end(),并且没有读取或监听传入的数据,则此事件可能不会被触发。
🌐 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);
});