Merged
Conversation
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.
This change adds a
res.reqproperty which refers to the originalIncomingMessagerequest object.The reasons for this small change are explained in #28673, but a quick summary:
http.createServer.reqin multiple places when determining response-specific behavior.resfrom thereqis already possible, this just adds the reverse.I'd recommend reading #28673 in full, I put a lot of thought/research into the different arguments.
You can imagine a world where you aren't forced to use frameworks for HTTP in Node, and instead we might benefit from a Lodash-like utility library with smaller, functional utilities…
…this would be helpful not only to those who don't want to use frameworks, but also those attempting to building framework-independent libraries and utilities, which is currently almost impossible in the Node ecosystem.
Thanks!
Also, to be clear, I'm not wed to the
res.reqnaming scheme if it needs to be changed for any reason. As long as there's a way to access the original request I don't care what the way is.Checklist