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
fix: request set headers #2817
fix: request set headers #2817
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to not alter req.raw.headers
. An alternative implementation is to redefine the headers
property on request in the setter, bypassing the getter and use a newly stored value.
looks good so far |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@Eomm are you still pursuiing this? |
Yes, I implemented the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor spelling comment. Otherwise lgtm
Co-authored-by: Vincent LE GOFF <vince.legoff@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
…into fix-joi-validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fix #2813
The use case is:
some validation framework returns an object as results of the validation
{ value: <validated object with defaults> }
.In this case, we must set that object as the
request.headers
value.Before #2426 we had a private
headers
property that was customized and it was acting like a mirror of theraw.headers
object.Now, with this PR, it becomes possible to manage the
HTTPIncompingRequest
's headers, so, for example, theonRequest
hooks will read headers that could be totally different in thepreHandler
hooks because of the validation process.What do you think?
(In any case, this PR needs more tests)
Checklist
npm run test
andnpm run benchmark
and the Code of conduct