Simplify handler trait (#221)

Rely on the `impl FromRequest for (T, ...)` rather than extracting things directly inside the macro.
This commit is contained in:
David Pedersen
2021-08-20 20:36:34 +02:00
committed by GitHub
parent e8bc3f5082
commit 44c58bdf5f
4 changed files with 108 additions and 110 deletions
+4 -4
View File
@@ -191,9 +191,9 @@ fn service_handle_on_router_still_impls_routing_dsl() {
#[test]
fn layered() {
let app = Router::new()
.route("/echo", get::<_, Body, _>(unit))
.route("/echo", get(unit))
.layer(timeout())
.handle_error(handle_error::<BoxError>);
.handle_error::<Body, _>(handle_error::<BoxError>);
check_make_svc::<_, _, _, Infallible>(app.into_make_service());
}
@@ -201,9 +201,9 @@ fn layered() {
#[tokio::test] // async because of `.boxed()`
async fn layered_boxed() {
let app = Router::new()
.route("/echo", get::<_, Body, _>(unit))
.route("/echo", get(unit))
.layer(timeout())
.boxed()
.boxed::<Body, _>()
.handle_error(handle_error::<BoxError>);
check_make_svc::<_, _, _, Infallible>(app.into_make_service());