-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Only allow last extractor to mutate the request #1272
Conversation
* Add `Once`/`Mut` type parameter for `FromRequest` and `RequestParts` * 🪄 * split traits * `FromRequest` for tuples * Remove `BodyAlreadyExtracted` * don't need fully qualified path * don't export `Once` and `Mut` * remove temp tests * depend on axum again Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
@jplatte I took at stab at the tuple impls but couldn't quite make it work, even with adding another possible value of |
I'll do that, yeah. Won't be in front of a capable computer until Sunday though. |
* port #[derive(TypedPath)] * wip: #[debug_handler] * fix #[debug_handler] * don't need itertools * also require `Send` * update expected error * support fully qualified `self`
* Port axum-extra * Update axum-core/Cargo.toml Co-authored-by: Jonas Platte <jplatte+git@posteo.de> * remove `impl FromRequest for Either*` Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
* Make private module truly private again * Simplify tuple FromRequest implementation
Open question from #1288: What should the final names for
|
Re
|
Missed this in #1287
* Update changelog * Remove default type for `S` in `Handler` * Clarify which types have default types for `S` * Apply suggestions from code review Co-authored-by: Jonas Platte <jplatte+git@posteo.de> Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Okay, let's go with that then. |
I guess this is ready for review now 😊 All the todos are done and CI is green. |
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 already reviewed everything individually, is more review needed?
Don't think so! |
Fixing #1115 requires touching pretty much every file (see #1121). So rather than implementing everything at once I think we should split the work into smaller PRs and then merge them into this branch. That way we don't have to review the whole thing at once.
Fixes #1115
TODO
Things to fix before we can merge this
FromRequestParts
document having to implementFromRequest
if you need the body. To help with https://github.com/tokio-rs/axum/pull/1283/files#r950838603Path
from anywhere without running the request throughRouter
and that shouldn't panic.FromRequest
andFromRequestParts
for tuples (seetuple.rs
)Handler::or
inaxum-extra
. Note this depends on the tuple impls#[derive(FromRequest)]
#[derive(FromRequestParts)]
? If so, that can be done after merging this. File issue if we want it.Mut
andOnce
.