事件:'headers'


¥Event: 'headers'

当接收到流的附加标头块时,例如接收到 1xx 信息标头块时,则会触发 'headers' 事件。监听器回调传递 HTTP/2 标头对象 和与标头关联的标志。

¥The 'headers' event is emitted when an additional block of headers is received for a stream, such as when a block of 1xx informational headers is received. The listener callback is passed the HTTP/2 Headers Object and flags associated with the headers.

stream.on('headers', (headers, flags) => {
  console.log(headers);
});