response.writeInformation(statusCode[, headers])


  • statusCode <number> HTTP 1xx 信息性状态码,在 100199 之间(包含两端),但不包括 101(切换协议),因为在 HTTP/2 中不允许使用该状态码。
  • headers <Object> 用于随信息响应发送的可选头部对象。

发送任意 HTTP 1xx 信息性响应,在 HTTP/2 中等同于一个 HEADERS 帧,其 :status 伪头为 1xx 状态码。在最终响应之前可多次调用。最终响应头发送后,该方法将无效,并返回 false

🌐 Sends an arbitrary HTTP 1xx informational response, equivalent in HTTP/2 to a HEADERS frame whose :status pseudo-header is a 1xx code. May be called multiple times before the final response. After the final response headers have been sent, this method is a no-op and returns false.

这是 response.writeContinue()response.writeEarlyHints() 的通用等效药。

🌐 This is the generic equivalent of response.writeContinue() and response.writeEarlyHints().

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