fix: refactor requestContextPlugin.spec.js to use response headers #176
fix: refactor requestContextPlugin.spec.js to use response headers #176mcollina merged 2 commits intofastify:masterfrom
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.
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.
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.
i have added a new case, does it make sense? what changes would you recommend 🤔 ?
There was a problem hiding this comment.
Hi @Eomm do you think we can merge this?
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 testandnpm run benchmark(can't find script benchmark)and the Code of conduct