Skip to content

Use via extractor's rejection instead of axum::response::Response #3261

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kyle-nweeia
Copy link

Fixes #3160.

Makes the from_request attribute use the rejection type assigned to the extractor by the FromRequest or FromRequestParts implementation. This brings it in line with the behavior documented at https://docs.rs/axum/latest/axum/extract/derive.FromRequest.html#the-whole-type-at-once.

Updates two tests that expected the extractor rejection to be axum::response::Response.

Copy link
Collaborator

@mladedav mladedav left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks.

@jplatte jplatte added the breaking change A PR that makes a breaking change. label Mar 27, 2025
@jplatte
Copy link
Member

jplatte commented Mar 27, 2025

A changelog entry would be nice.

@mladedav
Copy link
Collaborator

Regarding this being a breaking change - I guess we want to be on the safe side after the last release but it's true this was always just a bug since it's explicitly documented as using the other rejection.

But to be clear, do we want to wait for 0.9 before releasing this?

@jplatte
Copy link
Member

jplatte commented Mar 27, 2025

Yeah I'd like to wait. Maybe for 0.8 we should adjust the docs to reality.

@kyle-nweeia kyle-nweeia force-pushed the fix-fromrequestparts-rejection branch from 3824063 to 8498db9 Compare March 27, 2025 17:44
@kyle-nweeia
Copy link
Author

@jplatte do these changelog updates look correct?

@jplatte
Copy link
Member

jplatte commented Mar 27, 2025

Yeah, looks good. Thanks!

@kyle-nweeia kyle-nweeia force-pushed the fix-fromrequestparts-rejection branch from 95dcc3a to 07dfa7a Compare March 28, 2025 19:14
@jplatte
Copy link
Member

jplatte commented May 1, 2025

Looks like this needs a rebase.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change A PR that makes a breaking change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FromRequestParts derive macro uses wrong rejection
3 participants