Skip to content

Commit d808d27

Browse files
lpincatargos
authored andcommitted
doc: use Cookie in request.setHeader() examples
`Set-Cookie` is a response header, replace it with `Cookie`. PR-URL: #23707 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 086ee5e commit d808d27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/api/http.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,13 @@ The type of the return value depends on the arguments provided to
605605
```js
606606
request.setHeader('content-type', 'text/html');
607607
request.setHeader('Content-Length', Buffer.byteLength(body));
608-
request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);
608+
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
609609
const contentType = request.getHeader('Content-Type');
610610
// contentType is 'text/html'
611611
const contentLength = request.getHeader('Content-Length');
612612
// contentLength is of type number
613-
const setCookie = request.getHeader('set-cookie');
614-
// setCookie is of type string[]
613+
const cookie = request.getHeader('Cookie');
614+
// cookie is of type string[]
615615
```
616616

617617
### request.maxHeadersCount
@@ -655,7 +655,7 @@ request.setHeader('Content-Type', 'application/json');
655655
or
656656

657657
```js
658-
request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);
658+
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
659659
```
660660

661661
### request.setNoDelay([noDelay])

0 commit comments

Comments
 (0)