http: add 'sendingHeaders' event for response header manipulation#63996
Open
bjohansebas wants to merge 1 commit into
Open
http: add 'sendingHeaders' event for response header manipulation#63996bjohansebas wants to merge 1 commit into
bjohansebas wants to merge 1 commit into
Conversation
Collaborator
|
Review requested:
|
metcoder95
reviewed
Jun 19, 2026
| added: REPLACEME | ||
| --> | ||
|
|
||
| Emitted synchronously, exactly once, immediately before the status line and |
Member
There was a problem hiding this comment.
I believe it will be useful to put a sentence as warning when trying to use a promise for a listener.
Member
Author
There was a problem hiding this comment.
done, and I just added tests as well
Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
4d08718 to
0e6deb8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Okay, after so much time I can finally find time for this. Meanwhile, I’m still testing locally because building Node is quite heavy.
In summary, this serves as a replacement for on-headers, which is a package that does monkey-patching. The idea is to have an event so that middlewares like compression or express-session can use it to modify headers, and for now also, in the case of compression, to transform it into a gzip stream and send the data. However, we will still need two more events to fully remove the monkey-patching of res.write and res.end used in compression, express-session, and many other middlewares