-
Notifications
You must be signed in to change notification settings - Fork 155
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
Token from context #176
base: main
Are you sure you want to change the base?
Token from context #176
Conversation
…ving to provide a http.Request
Requesting review from @gorilla/pull-request-reviewers. :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #176 +/- ##
==========================================
+ Coverage 90.93% 91.03% +0.10%
==========================================
Files 5 5
Lines 353 357 +4
==========================================
+ Hits 321 325 +4
Misses 25 25
Partials 7 7 ☔ View full report in Codecov by Sentry. |
@jaitaiwan this looks good to me - mind giving it a quick second look and merging if you're happy with it as well? In summary, it makes it so a token can be fetched directly from a context instead of having to wrap it in an |
Hi there, |
I’m on mobile right now but I can’t see an easy way to re run. Will sort it on desktop soon. |
Any update on this? ;) |
What type of PR is this? (check all applicable)
Description
In order for
csrf
to play nicely with libraries like huma is seems beneficial to be able to retrieve a token not just from ahttp.Request
but also straight from thecontext.Context
.This avoids workarounds like creating a dummy request just to pass along the context.
Additionally, it feels more natural to me to pass the actually required value (with is a
context.Context
) instead of the value wrapped with something else that is not really required for retrieving the token.Related Tickets & Documents
n. a.
Added/updated tests?
Run verifications and test
make verify
is passingmake test
is passing