Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
doc: add Array type in http request headers#58049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: add Array type in http request headers #58049
Uh oh!
There was an error while loading. Please reload this page.
Conversation
nodejs-github-bot commented Apr 27, 2025
Review requested:
|
doc/api/http.md Outdated
| `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and | ||
| v6 will be used. | ||
| * `headers`{Object} An object containing request headers. | ||
| * `headers`{Object|Array} An object or an array of strings containing request headers. The array is in the same format as request.rawHeaders. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| *`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.
mikawsApr 28, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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 <[email protected]>
ff83ffa to ad2fb4dCompareDocument 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 <[email protected]>
ad2fb4d to 0b8059eComparemikaws commented Apr 28, 2025
I've fixed the commit message issues. |
doc/api/http.md Outdated
| `hostname`. Valid values are `4` or `6`. When unspecified, both IP v4 and | ||
| v6 will be used. | ||
| * `headers`{Object} An object containing request headers. | ||
| * `headers`{Object|Array} An object or an array of strings containing request headers. The array is in the same format as [`message.rawHeaders`][]. |
trivikrApr 29, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
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.
db8ca62 into nodejs:mainUh 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 <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
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 <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
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 <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
The http.request allows sending headers as an array of strings.
Fixes: #57986