response.writeInformation(statusCode[, headers][, callback])


  • statusCode <number> HTTP 1xx 信息性状态码,范围在 100199 之间(包含),但不包括 101(切换协议),101 仅通过 'upgrade' 事件可用。
  • headers <Object> | <Array> 用于随信息响应发送的可选头集合。接受与 response.writeHead() 相同的格式。
  • callback <Function> 可选,在消息写入套接字后调用一次。

向客户端发送任意 HTTP/1.1 1xx 信息响应。这是 response.writeContinue()response.writeProcessing()response.writeEarlyHints() 的通用等效方法,并且可以在最终响应之前多次调用。在最终响应头已经发送(通过 response.writeHead() 或隐式头)之后,调用此方法会抛出 ERR_HTTP_HEADERS_SENT

🌐 Sends an arbitrary HTTP/1.1 1xx informational response to the client. This is a generic equivalent of response.writeContinue(), response.writeProcessing() and response.writeEarlyHints(), and can be called multiple times before the final response. After the final response headers have been sent (via response.writeHead() or an implicit header), calling this method throws ERR_HTTP_HEADERS_SENT.

客户通过 http.ClientRequest 上的 'information' 事件接收这些响应。

🌐 Clients receive these responses via the 'information' event on http.ClientRequest.

response.writeInformation(110, { 'X-Progress': '50%' });