Skip to content

Commit b8944f6

Browse files
jakecastellimarco-ippolito
authored andcommitted
doc, http: add rejectNonStandardBodyWrites option, clear its behaviour
PR-URL: #53396 Fixes: #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]>
1 parent 9446278 commit b8944f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/http.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -2427,8 +2427,9 @@ it will switch to implicit header mode and flush the implicit headers.
24272427
This sends a chunk of the response body. This method may
24282428
be called multiple times to provide successive parts of the body.
24292429

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

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

0 commit comments

Comments
 (0)