Fix for service as bottom handler (#27)

Would previously fail because of a mismatch in error types.
This commit is contained in:
David Pedersen
2021-07-06 09:40:25 +02:00
committed by GitHub
parent c4d266e94d
commit 3cd4a1d6a6
5 changed files with 60 additions and 26 deletions
+11
View File
@@ -653,6 +653,17 @@ async fn different_request_body_types() {
assert_eq!(body, "foo");
}
#[tokio::test]
async fn service_in_bottom() {
async fn handler(_req: Request<hyper::Body>) -> Result<Response<hyper::Body>, hyper::Error> {
Ok(Response::new(hyper::Body::empty()))
}
let app = route("/", service::get(service_fn(handler)));
run_in_background(app).await;
}
/// Run a `tower::Service` in the background and get a URI for it.
async fn run_in_background<S, ResBody>(svc: S) -> SocketAddr
where