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

Ability to set context in middleware & capture responses #16

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

Gobd
Copy link
Contributor

@Gobd Gobd commented Jul 1, 2024

@raed-shomali
Copy link
Contributor

Thank you!

@raed-shomali raed-shomali merged commit bd3ee21 into slack-io:main Jul 1, 2024
3 checks passed
@trajan0x
Copy link

trajan0x commented Jul 2, 2024

Sorry, maybe I'm missing something here. Does this address response capture?

trajan0x added a commit to synapsecns/sanguine that referenced this pull request Jul 2, 2024
@Gobd
Copy link
Contributor Author

Gobd commented Jul 2, 2024

This should allow you to do

ctx := context.WithValue(cmdCtx.Context(), "test", "value")
cmdCtx = cmdCtx.WithContext(ctx)

to store any value you want in the context then access it in the next handler.

@raed-shomali
Copy link
Contributor

Might be nice to create an example of this for future users in the examples folder

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.

Ability to set context in middleware & capture responses
3 participants