diff --git a/doc/api/http.md b/doc/api/http.md index 83a401d97ee2eb..17bf15d6eccb1b 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -179,6 +179,14 @@ changes: **Default:** `'lifo'`. * `timeout` {number} Socket timeout in milliseconds. This will set the timeout when the socket is created. + * `separateHeadersValues` {boolean} If set to `true`, the request and the + response headers will never be squashed. + All request headers will be sent multiple times if the header + value was set to an array or set multiple times. + All response headers will always be returned as a string if the + header has been received once or as an array of strings if the header has + been received multiple times. + In both cases headers matching is case insensitive. `options` in [`socket.connect()`][] are also supported. @@ -983,6 +991,10 @@ or request.setHeader('Cookie', ['type=ninja', 'language=javascript']); ``` +If `separateHeadersValues` was set to `true` when the request was created, then +using this method will always append a new value to the list of values for this +header. + ### `request.setNoDelay([noDelay])` * `name` {string} Name of header -* Returns {string | undefined} +* Returns {string | string\[] | undefined} Gets the value of HTTP header with the given name. If such a name doesn't exist in message, it will be `undefined`. +If `separateHeadersValues` was set to `true` when the request or the server +were created, then the return value is always a string if the header has been +set once or an array of strings if the header has been set multiple times. + ### `outgoingMessage.getHeaderNames()`