@@ -2364,8 +2364,28 @@ header name:
2364
2364
` last-modified ` , ` location ` , ` max-forwards ` , ` proxy-authorization ` , ` referer ` ,
2365
2365
` retry-after ` , ` server ` , or ` user-agent ` are discarded.
2366
2366
* ` 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
+ ```
2369
2389
2370
2390
### ` message.httpVersion `
2371
2391
@@ -2499,6 +2519,18 @@ added: v0.3.0
2499
2519
2500
2520
The request/response trailers object. Only populated at the ` 'end' ` event.
2501
2521
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
+
2502
2534
### ` message.url `
2503
2535
2504
2536
<!-- YAML
@@ -2596,7 +2628,7 @@ Adds HTTP trailers (headers but at the end of the message) to the message.
2596
2628
Trailers will ** only** be emitted if the message is chunked encoded. If not,
2597
2629
the trailers will be silently discarded.
2598
2630
2599
- HTTP requires the ` Trailer ` header to be sent to emit trailers,
2631
+ HTTP requires the ` Trailer ` header to be sent to emit trailers,
2600
2632
with a list of header field names in its value, e.g.
2601
2633
2602
2634
``` js
@@ -2610,6 +2642,28 @@ message.end();
2610
2642
Attempting to set a header field name or value that contains invalid characters
2611
2643
will result in a ` TypeError ` being thrown.
2612
2644
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
+
2613
2667
### ` outgoingMessage.connection `
2614
2668
2615
2669
<!-- YAML
@@ -3026,6 +3080,9 @@ changes:
3026
3080
* ` keepAliveInitialDelay ` {number} If set to a positive number, it sets the
3027
3081
initial delay before the first keepalive probe is sent on an idle socket.
3028
3082
** 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 ` ; ` .
3029
3086
3030
3087
* ` requestListener ` {Function}
3031
3088
@@ -3260,12 +3317,15 @@ changes:
3260
3317
* ` protocol ` {string} Protocol to use. ** Default:** ` 'http:' ` .
3261
3318
* ` setHost ` {boolean}: Specifies whether or not to automatically add the
3262
3319
` Host ` header. Defaults to ` true ` .
3320
+ * ` signal ` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
3321
+ request.
3263
3322
* ` socketPath ` {string} Unix domain socket. Cannot be used if one of ` host `
3264
3323
or ` port ` is specified, as those specify a TCP Socket.
3265
3324
* ` timeout ` {number}: A number specifying the socket timeout in milliseconds.
3266
3325
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 ` ; ` .
3269
3329
* ` callback ` {Function}
3270
3330
* Returns: {http.ClientRequest}
3271
3331
@@ -3571,11 +3631,13 @@ try {
3571
3631
[ `http.request()` ] : #httprequestoptions-callback
3572
3632
[ `message.headers` ] : #messageheaders
3573
3633
[ `message.socket` ] : #messagesocket
3634
+ [ `message.trailers` ] : #messagetrailers
3574
3635
[ `net.Server.close()` ] : net.md#serverclosecallback
3575
3636
[ `net.Server` ] : net.md#class-netserver
3576
3637
[ `net.Socket` ] : net.md#class-netsocket
3577
3638
[ `net.createConnection()` ] : net.md#netcreateconnectionoptions-connectlistener
3578
3639
[ `new URL()` ] : url.md#new-urlinput-base
3640
+ [ `outgoingMessage.setHeader(name, value)` ] : #outgoingmessagesetheadername-value
3579
3641
[ `outgoingMessage.socket` ] : #outgoingmessagesocket
3580
3642
[ `removeHeader(name)` ] : #requestremoveheadername
3581
3643
[ `request.destroy()` ] : #requestdestroyerror
0 commit comments