http::header::ACCEPT_ENCODING, }; #[tokio::test] async fn single_encoding() { let req = Request::builder() .header(ACCEPT_ENCODING, "gzip") .body(()) .unwrap(); let encodings = AcceptEncoding::from_request_parts( &mut req.into_parts().0, &Arc::new(ServerConfig { is_json_api_enabled: false, }), ) .await .unwrap(); assert_eq!(encodings.0, Some("gzip".to_string())); } #[tokio::test] async fn accepts_encoding() { let req = Request::builder() .header(ACCEPT_ENCODING, "deflate;q=0.5, gzip;q=1.0, br;q=0.8") .body(()) .unwrap(); let encodings = AcceptEncoding::from_request_parts( &mut req.into_parts().0, &Arc::new(ServerConfig { is_json_api_enabled: false, }), ) .await .unwrap(); assert_eq!( encodings.0, Some("deflate;q=0.5, gzip;q=1.0, br;q=0.8".to_string()) ); assert!(encodings.is_acceptable(&HeaderValue::from_static("deflate"))); assert!(encodings.is_acceptable(&HeaderValue::from_static("gzip")));

Inscription #44972427

ID

947da92ff4...877942eei0

Detail

History

Action
Price
Marketplace
From
To
Time

INSCRIBED

-

-

-wul2

9 months

Sign Up for our Newsletter

And be the first to know about any updates!

OrdinalHub logo

All Rights Reserved OrdinalHub.com 2024

Support

Follow Us