@@ -2366,8 +2366,28 @@ header name:
23662366 ` last-modified ` , ` location ` , ` max-forwards ` , ` proxy-authorization ` , ` referer ` ,
23672367 ` retry-after ` , ` server ` , or ` user-agent ` are discarded.
23682368* ` set-cookie ` is always an array. Duplicates are added to the array.
2369- * For duplicate ` cookie ` headers, the values are joined together with '; '.
2370- * For all other headers, the values are joined together with ', '.
2369+ * For duplicate ` cookie ` headers, the values are joined together with ` ; ` .
2370+ * For all other headers, the values are joined together with ` , ` .
2371+
2372+ ### ` message.headersDistinct `
2373+
2374+ <!-- YAML
2375+ added: REPLACEME
2376+ -->
2377+
2378+ * {Object}
2379+
2380+ Similar to [ ` message.headers ` ] [ ] , but there is no join logic and the values are
2381+ always arrays of strings, even for headers received just once.
2382+
2383+ ``` js
2384+ // Prints something like:
2385+ //
2386+ // { 'user-agent': ['curl/7.22.0'],
2387+ // host: ['127.0.0.1:8000'],
2388+ // accept: ['*/*'] }
2389+ console .log (request .headersDistinct );
2390+ ```
23712391
23722392### ` message.httpVersion `
23732393
@@ -2501,6 +2521,18 @@ added: v0.3.0
25012521
25022522The request/response trailers object. Only populated at the ` 'end' ` event.
25032523
2524+ ### ` message.trailersDistinct `
2525+
2526+ <!-- YAML
2527+ added: REPLACEME
2528+ -->
2529+
2530+ * {Object}
2531+
2532+ Similar to [ ` message.trailers ` ] [ ] , but there is no join logic and the values are
2533+ always arrays of strings, even for headers received just once.
2534+ Only populated at the ` 'end' ` event.
2535+
25042536### ` message.url `
25052537
25062538<!-- YAML
@@ -2598,7 +2630,7 @@ Adds HTTP trailers (headers but at the end of the message) to the message.
25982630Trailers will ** only** be emitted if the message is chunked encoded. If not,
25992631the trailers will be silently discarded.
26002632
2601- HTTP requires the ` Trailer ` header to be sent to emit trailers,
2633+ HTTP requires the ` Trailer ` header to be sent to emit trailers,
26022634with a list of header field names in its value, e.g.
26032635
26042636``` js
@@ -2612,6 +2644,28 @@ message.end();
26122644Attempting to set a header field name or value that contains invalid characters
26132645will result in a ` TypeError ` being thrown.
26142646
2647+ ### ` outgoingMessage.appendHeader(name, value) `
2648+
2649+ <!-- YAML
2650+ added: REPLACEME
2651+ -->
2652+
2653+ * ` name ` {string} Header name
2654+ * ` value ` {string|string\[ ] } Header value
2655+ * Returns: {this}
2656+
2657+ Append a single header value for the header object.
2658+
2659+ If the value is an array, this is equivalent of calling this method multiple
2660+ times.
2661+
2662+ If there were no previous value for the header, this is equivalent of calling
2663+ [ ` outgoingMessage.setHeader(name, value) ` ] [ ] .
2664+
2665+ Depending of the value of ` options.uniqueHeaders ` when the client request or the
2666+ server were created, this will end up in the header being sent multiple times or
2667+ a single time with values joined using ` ; ` .
2668+
26152669### ` outgoingMessage.connection `
26162670
26172671<!-- YAML
@@ -3030,6 +3084,9 @@ changes:
30303084 * ` keepAliveInitialDelay ` {number} If set to a positive number, it sets the
30313085 initial delay before the first keepalive probe is sent on an idle socket.
30323086 ** Default:** ` 0 ` .
3087+ * ` uniqueHeaders ` {Array} A list of response headers that should be sent only
3088+ once. If the header's value is an array, the items will be joined
3089+ using ` ; ` .
30333090
30343091* ` requestListener ` {Function}
30353092
@@ -3264,12 +3321,15 @@ changes:
32643321 * ` protocol ` {string} Protocol to use. ** Default:** ` 'http:' ` .
32653322 * ` setHost ` {boolean}: Specifies whether or not to automatically add the
32663323 ` Host ` header. Defaults to ` true ` .
3324+ * ` signal ` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
3325+ request.
32673326 * ` socketPath ` {string} Unix domain socket. Cannot be used if one of ` host `
32683327 or ` port ` is specified, as those specify a TCP Socket.
32693328 * ` timeout ` {number}: A number specifying the socket timeout in milliseconds.
32703329 This will set the timeout before the socket is connected.
3271- * ` signal ` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
3272- request.
3330+ * ` uniqueHeaders ` {Array} A list of request headers that should be sent
3331+ only once. If the header's value is an array, the items will be joined
3332+ using ` ; ` .
32733333* ` callback ` {Function}
32743334* Returns: {http.ClientRequest}
32753335
@@ -3575,11 +3635,13 @@ try {
35753635[ `http.request()` ] : #httprequestoptions-callback
35763636[ `message.headers` ] : #messageheaders
35773637[ `message.socket` ] : #messagesocket
3638+ [ `message.trailers` ] : #messagetrailers
35783639[ `net.Server.close()` ] : net.md#serverclosecallback
35793640[ `net.Server` ] : net.md#class-netserver
35803641[ `net.Socket` ] : net.md#class-netsocket
35813642[ `net.createConnection()` ] : net.md#netcreateconnectionoptions-connectlistener
35823643[ `new URL()` ] : url.md#new-urlinput-base
3644+ [ `outgoingMessage.setHeader(name, value)` ] : #outgoingmessagesetheadername-value
35833645[ `outgoingMessage.socket` ] : #outgoingmessagesocket
35843646[ `removeHeader(name)` ] : #requestremoveheadername
35853647[ `request.destroy()` ] : #requestdestroyerror
0 commit comments