Skip to content
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: merging behavior of writeHead vs setHeader #3895

Closed
wants to merge 1 commit into from

Conversation

aredridel
Copy link
Contributor

Clarifies the behavior of the two ways of sending headers when used
together.

Clarifies the behavior of the two ways of sending headers when used
together.
@mscdex mscdex added http Issues or PRs related to the http subsystem. doc Issues and PRs related to the documentations. labels Nov 18, 2015
When headers have been set with `response.setHeader`, they will be merged with
any headers passed to `request.writeHead`, with the headers passed to
`request.writeHead` given precedence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 .. quick thought tho: a simple example might be worthwhile including here also... e.g.

// returns content-type = text/plain
const server = http.createServer((req,res)=>{
  res.setHeader('Content-Type', 'text/html');
  res.setHeader('X-Foo', 'bar');
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('ok');
});

@rvagg
Copy link
Member

rvagg commented Nov 18, 2015

methods should include () when referring to them (I think we're fairly consistent on that in the docs).

other than that, lgtm

@jasnell
Copy link
Member

jasnell commented Nov 18, 2015

LGTM with the with () fix @rvagg suggests

@thefourtheye
Copy link
Contributor

LGTM. +1 to both the suggestions.

@Qard
Copy link
Member

Qard commented Nov 26, 2015

Another LGTM here, with the same nit as the others, the () on the function reference. :)

@jasnell
Copy link
Member

jasnell commented Dec 14, 2015

ping @aredridel ... if you can please update to address the nits I can get this landed :-)

@MylesBorins
Copy link
Contributor

@aredridel did you have time to do the final fixup

@nodejs/documentation I think this might be a good candidate for someone to cleanup and land for @aredridel if they are too busy to take care of it right now

@silverwind
Copy link
Contributor

3da7d13 has landed with this change. Thanks @a0viedo!

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.

8 participants