diff --git a/src/extract/extractor_middleware.rs b/src/extract/extractor_middleware.rs index 7bb1de8d..77a76872 100644 --- a/src/extract/extractor_middleware.rs +++ b/src/extract/extractor_middleware.rs @@ -2,7 +2,7 @@ //! //! See [`extractor_middleware`] for more details. -use super::{rejection::BodyAlreadyExtracted, BodyAlreadyExtractedExt, FromRequest}; +use super::FromRequest; use crate::{body::BoxBody, response::IntoResponse}; use bytes::Bytes; use futures_util::{future::BoxFuture, ready}; @@ -220,11 +220,6 @@ where match extracted { Ok(_) => { - if req.extensions().get::().is_some() { - let res = BodyAlreadyExtracted.into_response().map(BoxBody::new); - return Poll::Ready(Ok(res)); - } - let mut svc = this.svc.take().expect("future polled after completion"); let future = svc.call(req); State::Call(future) diff --git a/src/tests.rs b/src/tests.rs index c2fec39e..a9ba386c 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -695,10 +695,6 @@ async fn test_extractor_middleware() { let app = route( "/", get(handler.layer(extract::extractor_middleware::())), - ) - .route( - "/take-body-error", - post(handler.layer(extract::extractor_middleware::())), ); let addr = run_in_background(app).await; @@ -719,14 +715,6 @@ async fn test_extractor_middleware() { .await .unwrap(); assert_eq!(res.status(), StatusCode::OK); - - let res = client - .post(format!("http://{}/take-body-error", addr)) - .body("foobar") - .send() - .await - .unwrap(); - assert_eq!(res.status(), StatusCode::INTERNAL_SERVER_ERROR); } /// Run a `tower::Service` in the background and get a URI for it.