-
-
Notifications
You must be signed in to change notification settings - Fork 15
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: refactor requestContextPlugin.spec.js to use response headers #176
Conversation
…stead of JSON body
#177 is a possible alternative approach. Not sure what is the best one :) |
test/requestContextPlugin.spec.js
Outdated
reply.status(204).send({ | ||
storedValue, | ||
}) | ||
reply.status(204).header('storedvalue', storedValue).send() |
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.
The solution LGTM
I preferred the #177 because the 204
status code was not necessary to make the module work, so it was adding confusion and it is better to remove it instead.
If you would like to update this PR adding an clear test such the plugin must keep the context across 20x requests
it would be best!
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.
Hey, so something like the plugin must keep the context across 204 requests => then use the headers in a separate case? @Eomm
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 have added a new case, does it make sense? what changes would you recommend 🤔 ?
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.
Hi @Eomm do you think we can merge this?
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
Fixes #175
I replaced the json body with value in headers. I found this to be the best approach. if anyone has any better solutions, happy to implement that as well.
Checklist
npm run test
andnpm run benchmark
(can't find script benchmark)and the Code of conduct