事件:'headers'


【Event: 'headers'

  • headers HTTP/2 头对象
  • flags <number>

当接收到流的附加头部块时,例如接收到一块 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);
});