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

Consider adding TryFrom<&Uri> for Query #2048

Closed
1 task done
CosmicHorrorDev opened this issue Jun 20, 2023 · 2 comments
Closed
1 task done

Consider adding TryFrom<&Uri> for Query #2048

CosmicHorrorDev opened this issue Jun 20, 2023 · 2 comments
Labels
A-axum C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue.

Comments

@CosmicHorrorDev
Copy link

  • I have looked for existing issues (including closed) about this

Feature Request

Consider adding impl TryFrom<&Uri> for axum::extract::Query

Motivation

I was porting a project from rocket and axum and accidentally regressed some endpoints from differences in query parsing. It would have been nice to have a simple way to test the query parsing in isolation, but the simplest solution I could come up with was to just copy the internals of Query's FromRequestParts

Proposal

Move the logic from Query's FromRequestParts implementation into TryFrom<&Uri> for Query and call Query::try_from(&parts.uri) in from_request_parts()

Only drawback I can think of is that this adds some slight noise to the API

Alternatives

None that seem compelling

@davidpdrsn davidpdrsn added C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. A-axum labels Jun 20, 2023
@davidpdrsn
Copy link
Member

Sure! That sounds like a fine addition to me.

@davidpdrsn
Copy link
Member

Fixed in #2058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-axum C-feature-request Category: A feature request, i.e: not implemented / a PR. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue.
Projects
None yet
Development

No branches or pull requests

2 participants