事件:'trailers'
¥Event: 'trailers'
-
headers
<HTTP/2 Headers Object> 描述标头的对象¥
headers
<HTTP/2 Headers Object> An object describing the headers -
flags
<number> 相关的数字标志¥
flags
<number> The associated numeric flags
当接收到与尾随标头字段关联的标头块时,则会触发 'trailers'
事件。监听器回调传递 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 and flags associated with the 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);
});