-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Conversation
Clarifies the behavior of the two ways of sending headers when used together.
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. | ||
|
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.
+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');
});
methods should include other than that, lgtm |
LGTM with the with |
LGTM. +1 to both the suggestions. |
Another LGTM here, with the same nit as the others, the |
ping @aredridel ... if you can please update to address the nits I can get this landed :-) |
@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 |
Clarifies the behavior of the two ways of sending headers when used
together.