axum/axum-macros/tests/from_request/pass/named.rs
David Pedersen 877e3fe4de Move TypedHeader to axum-extra (#1850)
Co-authored-by: Michael Scofield <mscofield0@tutanota.com>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2023-04-21 17:45:31 +02:00

27 lines
575 B
Rust

use axum::{
extract::FromRequest,
response::Response,
};
use axum_extra::{
TypedHeader,
typed_header::TypedHeaderRejection,
headers::{self, UserAgent},
};
#[derive(FromRequest)]
struct Extractor {
uri: axum::http::Uri,
user_agent: TypedHeader<UserAgent>,
content_type: TypedHeader<headers::ContentType>,
etag: Option<TypedHeader<headers::ETag>>,
host: Result<TypedHeader<headers::Host>, TypedHeaderRejection>,
body: String,
}
fn assert_from_request()
where
Extractor: FromRequest<(), Rejection = Response>,
{
}
fn main() {}