Skip to content

doc: clarify http.request supports headers as array #58810

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Dinesh0007000
Copy link

Updated the documentation for http.request to clarify the array format for headers.

Dinesh0007000 and others added 5 commits June 24, 2025 02:11
This PR updates the documentation for `http.request()` to clarify that the `headers` option can also be an array of key-value pairs, similar to `response.writeHead`.

Fixes: nodejs#57986
Added a detailed explanation for how the 'headers' option in http.request
can also be passed as a flat array of alternating header names and values.

This provides clarity for beginners and aligns with the format used in
response.writeHead() and request.rawHeaders.
- Removed duplicate definition of [`response.writeHead()`] as it already exists earlier in the file.
- Updated [`request.rawHeaders`] link to be relative (#requestrawheaders) instead of using an absolute URL.

These fixes resolve markdown linting issues flagged by the CI and ensure consistency with documentation standards.
This PR updates the documentation for `http.request()` to clarify that the `headers` option can also be an array of key-value pairs, similar to `response.writeHead`.

Fixes: nodejs#57986

doc: clarify headers array format in http.request options

Added a detailed explanation for how the 'headers' option in http.request
can also be passed as a flat array of alternating header names and values.

This provides clarity for beginners and aligns with the format used in
response.writeHead() and request.rawHeaders.

fix: address markdown linting issues and link formatting

- Removed duplicate definition of [`response.writeHead()`] as it already exists earlier in the file.
- Updated [`request.rawHeaders`] link to be relative (#requestrawheaders) instead of using an absolute URL.

These fixes resolve markdown linting issues flagged by the CI and ensure consistency with documentation standards.

temp: prepare for rebase
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants