Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRobert Nagy <ronagy@icloud.com>2020-09-20 10:32:06 +0300
committerMyles Borins <mylesborins@github.com>2020-10-14 23:21:22 +0300
commit6ff152cc671d05dc3871b348f7737a4cf963182f (patch)
treec7f6202349310b8eafa8569f2bac2febf8111f73 /doc
parent7d1cdd411f49ba173c5d017d951f6feb96c23abc (diff)
http: allow passing array of key/val into writeHead
Enables an optimization when the user already has the headers in an array form, e.g. when proxying. PR-URL: https://github.com/nodejs/node/pull/35274 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/http.md10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/api/http.md b/doc/api/http.md
index 97631cf5bf6..e84b0bb67f1 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -1786,6 +1786,9 @@ the request body should be sent. See the [`'checkContinue'`][] event on
<!-- YAML
added: v0.1.30
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/35274
+ description: Allow passing headers as an array.
- version:
- v11.10.0
- v10.17.0
@@ -1802,7 +1805,7 @@ changes:
* `statusCode` {number}
* `statusMessage` {string}
-* `headers` {Object}
+* `headers` {Object|Array}
* Returns: {http.ServerResponse}
Sends a response header to the request. The status code is a 3-digit HTTP
@@ -1810,6 +1813,11 @@ status code, like `404`. The last argument, `headers`, are the response headers.
Optionally one can give a human-readable `statusMessage` as the second
argument.
+`headers` may be an `Array` where the keys and values are in the same list.
+It is *not* a list of tuples. So, the even-numbered offsets are key values,
+and the odd-numbered offsets are the associated values. The array is in the same
+format as `request.rawHeaders`.
+
Returns a reference to the `ServerResponse`, so that calls can be chained.
```js