Uh oh!
There was an error while loading. Please reload this page.
doc: add Array type in http request headers - #58049
Conversation
nodejs-github-bot
commented
Apr 27, 2025
Review requested:
|
There was a problem hiding this comment.
| *`headers` {Object|Array} An object or an array of strings containing request headers. The array is in the same format as request.rawHeaders. | |
| *`headers` {Object|Array} An object or an array of strings containing request headers. The array is in the same format as [`message.rawHeaders`][]. |
and
[`message.rawHeaders`]: #messagerawheaders
at the end of the file.
There was a problem hiding this comment.
Thank you :)
I've updated the commit with the suggested change to reference [message.rawHeaders][].
Please let me know if there's anything else needed. See ad2fb4d.
ff83ffa to
ad2fb4dComparead2fb4d to
0b8059eComparemikaws
commented
Apr 28, 2025
I've fixed the commit message issues. |
There was a problem hiding this comment.
nit: limit line length to 80 characters, and remove extra space
| *`headers` {Object|Array} An object or an array of strings containing request headers. The array is in the same format as [`message.rawHeaders`][]. | |
| *`headers` {Object|Array} An object or an array of strings containing request | |
| headers. The array is in the same format as [`message.rawHeaders`][]. |
There was a problem hiding this comment.
Fixed as suggested, thanks for the careful review. See 238caa5.
Document that the headers option in http.request() can be either an object or an array of strings, similar to message.rawHeaders. PR-URL: nodejs#58049Fixes: nodejs#57986 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
0b8059e to
238caa5CompareThe latest @types/node changes add `string[]` to the `RequestOptions.headers` type: DefinitelyTyped/DefinitelyTyped#72617nodejs/node#58049 This PR adds a check and narrow the the type to `http.OutgoingHttpHeaders` before accessing user-agent property. We don't ever set the user agent header using the `string[]` form so this should be fine.
The latest @types/node changes add `string[]` to the `RequestOptions.headers` type: DefinitelyTyped/DefinitelyTyped#72617nodejs/node#58049 This PR adds a check and narrow the the type to `http.OutgoingHttpHeaders` before accessing user-agent property. We don't ever set the user agent header using the `string[]` form so this should be fine.
The latest @types/node changes add `string[]` to the `RequestOptions.headers` type: DefinitelyTyped/DefinitelyTyped#72617nodejs/node#58049 This PR adds a check and narrow the type to `http.OutgoingHttpHeaders` before accessing user-agent property. We don't ever set the user agent header using the `string[]` form so this should be fine.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Jun 27, 2025
Landed in db8ca62 |
Document that the headers option in http.request() can be either an object or an array of strings, similar to message.rawHeaders. PR-URL: #58049Fixes: #57986 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Document that the headers option in http.request() can be either an object or an array of strings, similar to message.rawHeaders. PR-URL: #58049Fixes: #57986 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Document that the headers option in http.request() can be either an object or an array of strings, similar to message.rawHeaders. PR-URL: #58049Fixes: #57986 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
The http.request allows sending headers as an array of strings.
Fixes: #57986