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 Scheme extractor #2504

Closed
1 task done
bengsparks opened this issue Jan 10, 2024 · 1 comment · Fixed by #2507
Closed
1 task done

Add Scheme extractor #2504

bengsparks opened this issue Jan 10, 2024 · 1 comment · Fixed by #2507
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@bengsparks
Copy link
Contributor

bengsparks commented Jan 10, 2024

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

Feature Request

I'd like an easy way to see the scheme / protocol section of the request, which can be found in various headers and the URI itself.

Motivation

Similar to #826, extracting of the scheme of a URI is desirable.

Proposal

use axum::extract::Scheme;

async fn foo(Scheme(scheme): Scheme) -> ...

Alternatives

Manually extracting the scheme via the parts of a URI / analyzing various headers, which is a tedious process.

If this is something that should be part of axum, I can submit a Pull Request with the implementation I already have (adapted from the existing extractor for hosts), and follow it up with some tests.

@davidpdrsn
Copy link
Member

Sure! If that’s possible it would be nice to have.

@davidpdrsn davidpdrsn added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants