Skip to content

Commit

Permalink
doc: fix the return type of outgoingMessage.setHeaders()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hkleungai authored Oct 11, 2024
1 parent ccd4faf commit acd698a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -3289,9 +3289,7 @@ added:
-->
* `headers` {Headers|Map}
* Returns: {http.ServerResponse}
Returns the response object.
* Returns: {this}
Sets multiple header values for implicit headers.
`headers` must be an instance of [`Headers`][] or `Map`,
Expand All @@ -3300,14 +3298,14 @@ its value will be replaced.
```js
const headers = new Headers({ foo: 'bar' });
response.setHeaders(headers);
outgoingMessage.setHeaders(headers);
```
or
```js
const headers = new Map([['foo', 'bar']]);
res.setHeaders(headers);
outgoingMessage.setHeaders(headers);
```
When headers have been set with [`outgoingMessage.setHeaders()`][],
Expand Down

0 comments on commit acd698a

Please sign in to comment.