Skip to content

Commit 24c7a94

Browse files
jakecastellitargos
authored andcommitted
doc, http: add rejectNonStandardBodyWrites option, clear its behaviour
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>
1 parent ab20214 commit 24c7a94

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

@@ -3571,6 +3572,9 @@ changes:
35713572
* `uniqueHeaders` {Array} A list of response headers that should be sent only
35723573
once. If the header's value is an array, the items will be joined
35733574
using `; `.
3575+
* `rejectNonStandardBodyWrites` {boolean} If set to `true`, an error is thrown
3576+
when writing to an HTTP response which does not have a body.
3577+
**Default:** `false`.
35743578
35753579
* `requestListener` {Function}
35763580

0 commit comments

Comments
 (0)