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: nodejs#53396
Fixes: nodejs#53035
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
jakecastelli authored and eliphazbouye committed Jun 20, 2024
1 parent 7cdb7d5 commit 90c39f9
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 @@ -3571,6 +3572,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 90c39f9

Please sign in to comment.