事件:'headers'


¥Event: 'headers'

当接收到流的附加标头块时,例如接收到 1xx 信息标头块时,则会触发 'headers' 事件。监听器回调函数会传递 HTTP/2 标头对象、与报头关联的标志以及原始格式的报头(参见 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, flags associated with the headers, and the headers in raw format (see HTTP/2 Raw Headers).

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