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

Add OptionalQuery extractor #2310

Merged
merged 5 commits into from
Nov 18, 2023
Merged

Add OptionalQuery extractor #2310

merged 5 commits into from
Nov 18, 2023

Conversation

mikhailantoshkin
Copy link
Contributor

Motivation

Resolves #2309

Solution

from_request_parts does an additional check if query parameters are supplied. If none are present the OptionalQuery(None) is returned, otherwise it falls back to logic identical to axum_extra::extract::Query.

Copy link
Member

@davidpdrsn davidpdrsn left a comment

Choose a reason for hiding this comment

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

Some minor nit picks but otherwise looks good!

axum-extra/src/extract/mod.rs Outdated Show resolved Hide resolved
axum-extra/src/extract/optional_query.rs Outdated Show resolved Hide resolved
Copy link
Member

@davidpdrsn davidpdrsn left a comment

Choose a reason for hiding this comment

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

Thanks!

@davidpdrsn davidpdrsn enabled auto-merge (squash) November 14, 2023 07:47
auto-merge was automatically disabled November 14, 2023 11:57

Head branch was pushed to by a user without write access

@mikhailantoshkin
Copy link
Contributor Author

@davidpdrsn, made clippy happy again, take a look, please

@mikhailantoshkin
Copy link
Contributor Author

Oh no, clippy is mad at axum-core now on 1.75.0-beta.1

@davidpdrsn
Copy link
Member

davidpdrsn commented Nov 14, 2023

I'll take a look later today!

But you're also free to submit a separate PR to fix it.

@davidpdrsn davidpdrsn enabled auto-merge (squash) November 18, 2023 12:29
@davidpdrsn davidpdrsn merged commit 39cc596 into tokio-rs:main Nov 18, 2023
18 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.

OptionalQuery extractor
2 participants