doc: use Cookie in request.setHeader() examples
`Set-Cookie` is a response header, replace it with `Cookie`. PR-URL: https://github.com/nodejs/node/pull/23707 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
7d2494d867
commit
862b7a1c7b
@ -605,13 +605,13 @@ The type of the return value depends on the arguments provided to
|
|||||||
```js
|
```js
|
||||||
request.setHeader('content-type', 'text/html');
|
request.setHeader('content-type', 'text/html');
|
||||||
request.setHeader('Content-Length', Buffer.byteLength(body));
|
request.setHeader('Content-Length', Buffer.byteLength(body));
|
||||||
request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);
|
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
|
||||||
const contentType = request.getHeader('Content-Type');
|
const contentType = request.getHeader('Content-Type');
|
||||||
// contentType is 'text/html'
|
// contentType is 'text/html'
|
||||||
const contentLength = request.getHeader('Content-Length');
|
const contentLength = request.getHeader('Content-Length');
|
||||||
// contentLength is of type number
|
// contentLength is of type number
|
||||||
const setCookie = request.getHeader('set-cookie');
|
const cookie = request.getHeader('Cookie');
|
||||||
// setCookie is of type string[]
|
// cookie is of type string[]
|
||||||
```
|
```
|
||||||
|
|
||||||
### request.maxHeadersCount
|
### request.maxHeadersCount
|
||||||
@ -655,7 +655,7 @@ request.setHeader('Content-Type', 'application/json');
|
|||||||
or
|
or
|
||||||
|
|
||||||
```js
|
```js
|
||||||
request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);
|
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
|
||||||
```
|
```
|
||||||
|
|
||||||
### request.setNoDelay([noDelay])
|
### request.setNoDelay([noDelay])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user