mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Improve compile times (#184)
* Inline `handler::IntoService` * Inline `BoxResponseBody` * Add missing debug impl
This commit is contained in:
@@ -39,17 +39,19 @@ mod for_handlers {
|
||||
mod for_services {
|
||||
use super::*;
|
||||
use crate::service::get;
|
||||
use headers::HeaderValue;
|
||||
|
||||
#[tokio::test]
|
||||
async fn get_handles_head() {
|
||||
let app = route(
|
||||
"/",
|
||||
get((|| async {
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert("x-some-header", "foobar".parse().unwrap());
|
||||
(headers, "you shouldn't see this")
|
||||
})
|
||||
.into_service()),
|
||||
get(service_fn(|req: Request<Body>| async move {
|
||||
let res = Response::builder()
|
||||
.header("x-some-header", "foobar".parse::<HeaderValue>().unwrap())
|
||||
.body(Body::from("you shouldn't see this"))
|
||||
.unwrap();
|
||||
Ok::<_, Infallible>(res)
|
||||
})),
|
||||
);
|
||||
|
||||
// don't use reqwest because it always strips bodies from HEAD responses
|
||||
|
||||
Reference in New Issue
Block a user