@@ -2364,8 +2364,28 @@ header name:
23642364 ` last-modified ` , ` location ` , ` max-forwards ` , ` proxy-authorization ` , ` referer ` ,
23652365 ` retry-after ` , ` server ` , or ` user-agent ` are discarded.
23662366* ` set-cookie ` is always an array. Duplicates are added to the array.
2367- * For duplicate ` cookie ` headers, the values are joined together with '; '.
2368- * For all other headers, the values are joined together with ', '.
2367+ * For duplicate ` cookie ` headers, the values are joined together with ` ; ` .
2368+ * For all other headers, the values are joined together with ` , ` .
2369+
2370+ ### ` message.headersDistinct `
2371+
2372+ <!-- YAML
2373+ added: REPLACEME
2374+ -->
2375+
2376+ * {Object}
2377+
2378+ Similar to [ ` message.headers ` ] [ ] , but there is no join logic and the values are
2379+ always arrays of strings, even for headers received just once.
2380+
2381+ ``` js
2382+ // Prints something like:
2383+ //
2384+ // { 'user-agent': ['curl/7.22.0'],
2385+ // host: ['127.0.0.1:8000'],
2386+ // accept: ['*/*'] }
2387+ console .log (request .headersDistinct );
2388+ ```
23692389
23702390### ` message.httpVersion `
23712391
@@ -2499,6 +2519,18 @@ added: v0.3.0
24992519
25002520The request/response trailers object. Only populated at the ` 'end' ` event.
25012521
2522+ ### ` message.trailersDistinct `
2523+
2524+ <!-- YAML
2525+ added: REPLACEME
2526+ -->
2527+
2528+ * {Object}
2529+
2530+ Similar to [ ` message.trailers ` ] [ ] , but there is no join logic and the values are
2531+ always arrays of strings, even for headers received just once.
2532+ Only populated at the ` 'end' ` event.
2533+
25022534### ` message.url `
25032535
25042536<!-- YAML
@@ -2596,7 +2628,7 @@ Adds HTTP trailers (headers but at the end of the message) to the message.
25962628Trailers will ** only** be emitted if the message is chunked encoded. If not,
25972629the trailers will be silently discarded.
25982630
2599- HTTP requires the ` Trailer ` header to be sent to emit trailers,
2631+ HTTP requires the ` Trailer ` header to be sent to emit trailers,
26002632with a list of header field names in its value, e.g.
26012633
26022634``` js
@@ -2610,6 +2642,28 @@ message.end();
26102642Attempting to set a header field name or value that contains invalid characters
26112643will result in a ` TypeError ` being thrown.
26122644
2645+ ### ` outgoingMessage.appendHeader(name, value) `
2646+
2647+ <!-- YAML
2648+ added: REPLACEME
2649+ -->
2650+
2651+ * ` name ` {string} Header name
2652+ * ` value ` {string|string\[ ] } Header value
2653+ * Returns: {this}
2654+
2655+ Append a single header value for the header object.
2656+
2657+ If the value is an array, this is equivalent of calling this method multiple
2658+ times.
2659+
2660+ If there were no previous value for the header, this is equivalent of calling
2661+ [ ` outgoingMessage.setHeader(name, value) ` ] [ ] .
2662+
2663+ Depending of the value of ` options.uniqueHeaders ` when the client request or the
2664+ server were created, this will end up in the header being sent multiple times or
2665+ a single time with values joined using ` ; ` .
2666+
26132667### ` outgoingMessage.connection `
26142668
26152669<!-- YAML
@@ -3026,6 +3080,9 @@ changes:
30263080 * ` keepAliveInitialDelay ` {number} If set to a positive number, it sets the
30273081 initial delay before the first keepalive probe is sent on an idle socket.
30283082 ** Default:** ` 0 ` .
3083+ * ` uniqueHeaders ` {Array} A list of response headers that should be sent only
3084+ once. If the header's value is an array, the items will be joined
3085+ using ` ; ` .
30293086
30303087* ` requestListener ` {Function}
30313088
@@ -3260,12 +3317,15 @@ changes:
32603317 * ` protocol ` {string} Protocol to use. ** Default:** ` 'http:' ` .
32613318 * ` setHost ` {boolean}: Specifies whether or not to automatically add the
32623319 ` Host ` header. Defaults to ` true ` .
3320+ * ` signal ` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
3321+ request.
32633322 * ` socketPath ` {string} Unix domain socket. Cannot be used if one of ` host `
32643323 or ` port ` is specified, as those specify a TCP Socket.
32653324 * ` timeout ` {number}: A number specifying the socket timeout in milliseconds.
32663325 This will set the timeout before the socket is connected.
3267- * ` signal ` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
3268- request.
3326+ * ` uniqueHeaders ` {Array} A list of request headers that should be sent
3327+ only once. If the header's value is an array, the items will be joined
3328+ using ` ; ` .
32693329* ` callback ` {Function}
32703330* Returns: {http.ClientRequest}
32713331
@@ -3571,11 +3631,13 @@ try {
35713631[ `http.request()` ] : #httprequestoptions-callback
35723632[ `message.headers` ] : #messageheaders
35733633[ `message.socket` ] : #messagesocket
3634+ [ `message.trailers` ] : #messagetrailers
35743635[ `net.Server.close()` ] : net.md#serverclosecallback
35753636[ `net.Server` ] : net.md#class-netserver
35763637[ `net.Socket` ] : net.md#class-netsocket
35773638[ `net.createConnection()` ] : net.md#netcreateconnectionoptions-connectlistener
35783639[ `new URL()` ] : url.md#new-urlinput-base
3640+ [ `outgoingMessage.setHeader(name, value)` ] : #outgoingmessagesetheadername-value
35793641[ `outgoingMessage.socket` ] : #outgoingmessagesocket
35803642[ `removeHeader(name)` ] : #requestremoveheadername
35813643[ `request.destroy()` ] : #requestdestroyerror
0 commit comments