Skip to content
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

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

shawshankkumar
Copy link
Contributor

@shawshankkumar shawshankkumar commented Dec 18, 2023

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

@alfonsograziano
Copy link
Contributor

#177 is a possible alternative approach. Not sure what is the best one :)

reply.status(204).send({
storedValue,
})
reply.status(204).header('storedvalue', storedValue).send()
Copy link
Member

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!

Copy link
Contributor Author

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

Copy link
Contributor Author

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 🤔 ?

Copy link
Contributor Author

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?

@Fdawgs Fdawgs requested a review from Eomm November 1, 2024 11:48
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 59c967f into fastify:master Nov 18, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI seems to be failing
4 participants