stream.sendHeaders(headers[, options])
headers<Object> 带有字符串键和字符串或字符串数组值的头对象。伪头(:method、:path等)必须出现在常规头之前。options<Object>terminal<boolean> 如果true,在头信息之后流将关闭发送(不会有正文跟随)。默认值:false。
- 返回:<boolean>
在流上发送初始或响应头。对于客户端流,这会发送请求头。对于服务器端流,这会发送响应头。如果会话不支持头,会抛出 ERR_INVALID_STATE。
🌐 Sends initial or response headers on the stream. For client-side streams,
this sends request headers. For server-side streams, this sends response
headers. Throws ERR_INVALID_STATE if the session does not support headers.