Skip to content

Commit acd698a

Browse files
authored
doc: fix the return type of outgoingMessage.setHeaders()
The actual implementation returns `outgoingMessage` itself, but not exactly `http.ServerResponse`. Refs: https://github.com/nodejs/node/blob/20d8b85d3493bec944de541a896e0165dd356345/lib/_http_outgoing.js#L712-L751 PR-URL: #55290 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Qingyu Deng <i@ayase-lab.com>
1 parent ccd4faf commit acd698a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

doc/api/http.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -3289,9 +3289,7 @@ added:
32893289
-->
32903290
32913291
* `headers` {Headers|Map}
3292-
* Returns: {http.ServerResponse}
3293-
3294-
Returns the response object.
3292+
* Returns: {this}
32953293
32963294
Sets multiple header values for implicit headers.
32973295
`headers` must be an instance of [`Headers`][] or `Map`,
@@ -3300,14 +3298,14 @@ its value will be replaced.
33003298
33013299
```js
33023300
const headers = new Headers({ foo: 'bar' });
3303-
response.setHeaders(headers);
3301+
outgoingMessage.setHeaders(headers);
33043302
```
33053303
33063304
or
33073305
33083306
```js
33093307
const headers = new Map([['foo', 'bar']]);
3310-
res.setHeaders(headers);
3308+
outgoingMessage.setHeaders(headers);
33113309
```
33123310
33133311
When headers have been set with [`outgoingMessage.setHeaders()`][],

0 commit comments

Comments
 (0)