-
-
Notifications
You must be signed in to change notification settings - Fork 37.2k
Make http.OutgoingMessage._writeRaw public #22624
Copy link
Copy link
Closed
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.stalledIssues and PRs manually marked as stalled and scheduled for automatic closure.Issues and PRs manually marked as stalled and scheduled for automatic closure.
Description
Activity
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.stalledIssues and PRs manually marked as stalled and scheduled for automatic closure.Issues and PRs manually marked as stalled and scheduled for automatic closure.
Is your feature request related to a problem? Please describe.
I am trying to return HTTP informational statuses to the client. In particular 100, 102, 103 but I would also like to open the door to being able to support future informational status codes.
Both 100 and 102 have a dedicated method:
HttpServerResponse.sendContinuefor 100 andHttpServerResponse.sendProcessingfor 102.It would be possible to add another function like it (sendEarlyHints), but it seems a little silly given that these informational statuses more or less follow the same structure.
The http2 library solves this with the
additionalHeadersfunction. To illustrate, this is how I send any informational status using http2:This is how I do it for the HTTP1 api:
The problem here is that I'm using
res._writeRaw, an undocumented 'private' feature. I would like to not have to rely on this, but as far as I can tell, it's the only 'sane' way.Describe the solution you'd like
Make
_writeRawa documented, supported feature OR supply a reasonable API for returning any 1xx status header.Describe alternatives you've considered
As far as I know there's no real alternative.