★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/d808d27120Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
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>
  • Loading branch information
lpinca authored and targos committed Oct 24, 2018
1 parent 086ee5e commit d808d271209b693fc2d7f2cc85b9ab269df11bee
Showing with 4 additions and 4 deletions.
  1. +4 −4 doc/api/http.md
@@ -605,13 +605,13 @@ The type of the return value depends on the arguments provided to
```js
request.setHeader('content-type', 'text/html');
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');
// contentType is 'text/html'
const contentLength = request.getHeader('Content-Length');
// contentLength is of type number
const setCookie = request.getHeader('set-cookie');
// setCookie is of type string[]
const cookie = request.getHeader('Cookie');
// cookie is of type string[]
```

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

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

### request.setNoDelay([noDelay])

0 comments on commit d808d27

Please sign in to comment.