-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.
Description
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
return this
, allowing a .end
to be appended. For example:
res.writeHead(201, headers).end(body);
This is an error, since writeHead
returns undefined
.
Describe the solution you'd like
I'd like to have res.setHeader
and res.writeHead
return this
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.
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.