-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
res.setHeader and res.writeHead should return this #25935
Labels
feature request
Issues that request new features to be added to Node.js.
http
Issues or PRs related to the http subsystem.
Comments
bnoordhuis
added
http
Issues or PRs related to the http subsystem.
feature request
Issues that request new features to be added to Node.js.
labels
Feb 5, 2019
Seems like an uncontroversial change. Pull request welcome, I'd say. |
Thanks. I'll work on this this evening (UTC). |
4 tasks
addaleax
pushed a commit
that referenced
this issue
Feb 9, 2019
Fixes: #25935 PR-URL: #25974 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
targos
pushed a commit
that referenced
this issue
Feb 10, 2019
Fixes: #25935 PR-URL: #25974 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
targos
pushed a commit
that referenced
this issue
Feb 10, 2019
Fixes: #25935 PR-URL: #25974 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
BethGriggs
pushed a commit
that referenced
this issue
Oct 7, 2019
Fixes: #25935 PR-URL: #25974 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
BethGriggs
pushed a commit
that referenced
this issue
Oct 7, 2019
Fixes: #25935 PR-URL: #25974 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature request
Issues that request new features to be added to Node.js.
http
Issues or PRs related to the http subsystem.
Is your feature request related to a problem? Please describe.
When working with vanilla node HTTP servers, I frequently make the mistake that
res.setHeader
and (more often)res.writeHead
returnthis
, allowing a.end
to be appended. For example:This is an error, since
writeHead
returnsundefined
.Describe the solution you'd like
I'd like to have
res.setHeader
andres.writeHead
returnthis
to allow chaining. The same behaviour should be added to the HTTP/2 compatibility module too. I'm happy to put together a pull request if you are open to the change.Describe alternatives you've considered
I sometimes define a helper function to do this, but it's clunky.
The text was updated successfully, but these errors were encountered: