diff --git a/doc/api/http.md b/doc/api/http.md index 93fa82b228f15c..d28895ee484303 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -2333,8 +2333,28 @@ header name: `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`, or `user-agent` are discarded. * `set-cookie` is always an array. Duplicates are added to the array. -* For duplicate `cookie` headers, the values are joined together with '; '. -* For all other headers, the values are joined together with ', '. +* For duplicate `cookie` headers, the values are joined together with `; `. +* For all other headers, the values are joined together with `, `. + +### `message.headersDistinct` + + + +* {Object} + +Similar to [`message.headers`][], but there is no join logic and the values are +always arrays of strings, even for headers received just once. + +```js +// Prints something like: +// +// { 'user-agent': ['curl/7.22.0'], +// host: ['127.0.0.1:8000'], +// accept: ['*/*'] } +console.log(request.headersDistinct); +``` ### `message.httpVersion` @@ -2468,6 +2488,18 @@ added: v0.3.0 The request/response trailers object. Only populated at the `'end'` event. +### `message.trailersDistinct` + + + +* {Object} + +Similar to [`message.trailers`][], but there is no join logic and the values are +always arrays of strings, even for headers received just once. +Only populated at the `'end'` event. + ### `message.url` + +* `name` {string} Header name +* `value` {string|string\[]} Header value +* Returns: {this} + +Append a single header value for the header object. + +If the value is an array, this is equivalent of calling this method multiple +times. + +If there were no previous value for the header, this is equivalent of calling +[`outgoingMessage.setHeader(name, value)`][]. + +Depending of the value of `options.uniqueHeaders` when the client request or the +server were created, this will end up in the header being sent multiple times or +a single time with values joined using `; `. + ### `outgoingMessage.connection`