Skip to content

Commit

Permalink
doc, http: add rejectNonStandardBodyWrites option, clear its behaviour
Browse files Browse the repository at this point in the history
PR-URL: #53396
Fixes: #53035
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
jakecastelli authored and marco-ippolito committed Jul 19, 2024
1 parent 9446278 commit b8944f6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -2427,8 +2427,9 @@ it will switch to implicit header mode and flush the implicit headers.
This sends a chunk of the response body. This method may
be called multiple times to provide successive parts of the body.

Writing to the body is not allowed when the request method or response status
do not support content. If an attempt is made to write to the body for a
If `rejectNonStandardBodyWrites` is set to true in `createServer`
then writing to the body is not allowed when the request method or response
status do not support content. If an attempt is made to write to the body for a
HEAD request or as part of a `204` or `304`response, a synchronous `Error`
with the code `ERR_HTTP_BODY_NOT_ALLOWED` is thrown.

Expand Down Expand Up @@ -3569,6 +3570,9 @@ changes:
* `uniqueHeaders` {Array} A list of response headers that should be sent only
once. If the header's value is an array, the items will be joined
using `; `.
* `rejectNonStandardBodyWrites` {boolean} If set to `true`, an error is thrown
when writing to an HTTP response which does not have a body.
**Default:** `false`.
* `requestListener` {Function}
Expand Down

0 comments on commit b8944f6

Please sign in to comment.