@@ -2333,8 +2333,28 @@ header name:
2333
2333
` last-modified ` , ` location ` , ` max-forwards ` , ` proxy-authorization ` , ` referer ` ,
2334
2334
` retry-after ` , ` server ` , or ` user-agent ` are discarded.
2335
2335
* ` set-cookie ` is always an array. Duplicates are added to the array.
2336
- * For duplicate ` cookie ` headers, the values are joined together with '; '.
2337
- * For all other headers, the values are joined together with ', '.
2336
+ * For duplicate ` cookie ` headers, the values are joined together with ` ; ` .
2337
+ * For all other headers, the values are joined together with ` , ` .
2338
+
2339
+ ### ` message.headersDistinct `
2340
+
2341
+ <!-- YAML
2342
+ added: REPLACEME
2343
+ -->
2344
+
2345
+ * {Object}
2346
+
2347
+ Similar to [ ` message.headers ` ] [ ] , but there is no join logic and the values are
2348
+ always arrays of strings, even for headers received just once.
2349
+
2350
+ ``` js
2351
+ // Prints something like:
2352
+ //
2353
+ // { 'user-agent': ['curl/7.22.0'],
2354
+ // host: ['127.0.0.1:8000'],
2355
+ // accept: ['*/*'] }
2356
+ console .log (request .headersDistinct );
2357
+ ```
2338
2358
2339
2359
### ` message.httpVersion `
2340
2360
@@ -2468,6 +2488,18 @@ added: v0.3.0
2468
2488
2469
2489
The request/response trailers object. Only populated at the ` 'end' ` event.
2470
2490
2491
+ ### ` message.trailersDistinct `
2492
+
2493
+ <!-- YAML
2494
+ added: REPLACEME
2495
+ -->
2496
+
2497
+ * {Object}
2498
+
2499
+ Similar to [ ` message.trailers ` ] [ ] , but there is no join logic and the values are
2500
+ always arrays of strings, even for headers received just once.
2501
+ Only populated at the ` 'end' ` event.
2502
+
2471
2503
### ` message.url `
2472
2504
2473
2505
<!-- YAML
@@ -2565,7 +2597,7 @@ Adds HTTP trailers (headers but at the end of the message) to the message.
2565
2597
Trailers will ** only** be emitted if the message is chunked encoded. If not,
2566
2598
the trailers will be silently discarded.
2567
2599
2568
- HTTP requires the ` Trailer ` header to be sent to emit trailers,
2600
+ HTTP requires the ` Trailer ` header to be sent to emit trailers,
2569
2601
with a list of header field names in its value, e.g.
2570
2602
2571
2603
``` js
@@ -2579,6 +2611,28 @@ message.end();
2579
2611
Attempting to set a header field name or value that contains invalid characters
2580
2612
will result in a ` TypeError ` being thrown.
2581
2613
2614
+ ### ` outgoingMessage.appendHeader(name, value) `
2615
+
2616
+ <!-- YAML
2617
+ added: REPLACEME
2618
+ -->
2619
+
2620
+ * ` name ` {string} Header name
2621
+ * ` value ` {string|string\[ ] } Header value
2622
+ * Returns: {this}
2623
+
2624
+ Append a single header value for the header object.
2625
+
2626
+ If the value is an array, this is equivalent of calling this method multiple
2627
+ times.
2628
+
2629
+ If there were no previous value for the header, this is equivalent of calling
2630
+ [ ` outgoingMessage.setHeader(name, value) ` ] [ ] .
2631
+
2632
+ Depending of the value of ` options.uniqueHeaders ` when the client request or the
2633
+ server were created, this will end up in the header being sent multiple times or
2634
+ a single time with values joined using ` ; ` .
2635
+
2582
2636
### ` outgoingMessage.connection `
2583
2637
2584
2638
<!-- YAML
@@ -2970,6 +3024,9 @@ changes:
2970
3024
* ` keepAliveInitialDelay ` {number} If set to a positive number, it sets the
2971
3025
initial delay before the first keepalive probe is sent on an idle socket.
2972
3026
** Default:** ` 0 ` .
3027
+ * ` uniqueHeaders ` {Array} A list of response headers that should be sent only
3028
+ once. If the header's value is an array, the items will be joined
3029
+ using ` ; ` .
2973
3030
2974
3031
* ` requestListener ` {Function}
2975
3032
@@ -3202,12 +3259,15 @@ changes:
3202
3259
* ` protocol ` {string} Protocol to use. ** Default:** ` 'http:' ` .
3203
3260
* ` setHost ` {boolean}: Specifies whether or not to automatically add the
3204
3261
` Host ` header. Defaults to ` true ` .
3262
+ * ` signal ` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
3263
+ request.
3205
3264
* ` socketPath ` {string} Unix domain socket. Cannot be used if one of ` host `
3206
3265
or ` port ` is specified, as those specify a TCP Socket.
3207
3266
* ` timeout ` {number}: A number specifying the socket timeout in milliseconds.
3208
3267
This will set the timeout before the socket is connected.
3209
- * ` signal ` {AbortSignal}: An AbortSignal that may be used to abort an ongoing
3210
- request.
3268
+ * ` uniqueHeaders ` {Array} A list of request headers that should be sent
3269
+ only once. If the header's value is an array, the items will be joined
3270
+ using ` ; ` .
3211
3271
* ` callback ` {Function}
3212
3272
* Returns: {http.ClientRequest}
3213
3273
@@ -3513,11 +3573,13 @@ try {
3513
3573
[ `http.request()` ] : #httprequestoptions-callback
3514
3574
[ `message.headers` ] : #messageheaders
3515
3575
[ `message.socket` ] : #messagesocket
3576
+ [ `message.trailers` ] : #messagetrailers
3516
3577
[ `net.Server.close()` ] : net.md#serverclosecallback
3517
3578
[ `net.Server` ] : net.md#class-netserver
3518
3579
[ `net.Socket` ] : net.md#class-netsocket
3519
3580
[ `net.createConnection()` ] : net.md#netcreateconnectionoptions-connectlistener
3520
3581
[ `new URL()` ] : url.md#new-urlinput-base
3582
+ [ `outgoingMessage.setHeader(name, value)` ] : #outgoingmessagesetheadername-value
3521
3583
[ `outgoingMessage.socket` ] : #outgoingmessagesocket
3522
3584
[ `removeHeader(name)` ] : #requestremoveheadername
3523
3585
[ `request.destroy()` ] : #requestdestroyerror
0 commit comments