Fix Handler::with_state not working if request body was changed via layer (#1536)

Previously

```rust
handler.layer(RequestBodyLimitLayer::new(...)).with_state(...)
```

didn't work because we required the same request body all the way
through.
This commit is contained in:
David Pedersen
2022-11-18 11:00:52 +01:00
committed by GitHub
parent b1f894a500
commit 2e8a7e51a1
7 changed files with 56 additions and 24 deletions
@@ -12,7 +12,7 @@ error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {fo
| |
| required by a bound introduced by this call
|
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
= help: the trait `Handler<T, S, B2>` is implemented for `Layered<L, H, T, S, B, B2>`
note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
@@ -12,7 +12,7 @@ error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {fo
| |
| required by a bound introduced by this call
|
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
= help: the trait `Handler<T, S, B2>` is implemented for `Layered<L, H, T, S, B, B2>`
note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
@@ -12,7 +12,7 @@ error[E0277]: the trait bound `fn(MyExtractor) -> impl Future<Output = ()> {hand
| |
| required by a bound introduced by this call
|
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
= help: the trait `Handler<T, S, B2>` is implemented for `Layered<L, H, T, S, B, B2>`
note: required by a bound in `axum::routing::get`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
@@ -28,7 +28,7 @@ error[E0277]: the trait bound `fn(Result<MyExtractor, MyRejection>) -> impl Futu
| |
| required by a bound introduced by this call
|
= help: the trait `Handler<T, S, B>` is implemented for `Layered<L, H, T, S, B>`
= help: the trait `Handler<T, S, B2>` is implemented for `Layered<L, H, T, S, B, B2>`
note: required by a bound in `MethodRouter::<S, B>::post`
--> $WORKSPACE/axum/src/routing/method_routing.rs
|