diff --git a/actix-web/src/types/either.rs b/actix-web/src/types/either.rs index 7883e89f6..d8b3f1180 100644 --- a/actix-web/src/types/either.rs +++ b/actix-web/src/types/either.rs @@ -238,7 +238,7 @@ where match res { Ok(bytes) => { let fallback = bytes.clone(); - let left = L::from_request(this.req, &mut payload_from_bytes(bytes)); + let left = L::from_request(this.req, &mut dev::Payload::from(bytes)); EitherExtractState::Left { left, fallback } } Err(err) => break Err(EitherExtractError::Bytes(err)), @@ -251,7 +251,7 @@ where Err(left_err) => { let right = R::from_request( this.req, - &mut payload_from_bytes(mem::take(fallback)), + &mut dev::Payload::from(mem::take(fallback)), ); EitherExtractState::Right { left_err: Some(left_err), @@ -276,12 +276,6 @@ where } } -fn payload_from_bytes(bytes: Bytes) -> dev::Payload { - let (_, mut h1_payload) = actix_http::h1::Payload::create(true); - h1_payload.unread_data(bytes); - dev::Payload::from(h1_payload) -} - #[cfg(test)] mod tests { use serde::{Deserialize, Serialize}; diff --git a/awc/Cargo.toml b/awc/Cargo.toml index e399aef76..94eebcbcf 100644 --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -98,7 +98,7 @@ dangerous-h2c = [] [dependencies] actix-codec = "0.5" actix-service = "2" -actix-http = { version = "3.7", features = ["http2", "ws"] } +actix-http = { version = "3.10", features = ["http2", "ws"] } actix-rt = { version = "2.1", default-features = false } actix-tls = { version = "3.4", features = ["connect", "uri"] } actix-utils = "3" diff --git a/awc/src/test.rs b/awc/src/test.rs index 126583179..a7ed3faf0 100644 --- a/awc/src/test.rs +++ b/awc/src/test.rs @@ -65,9 +65,7 @@ impl TestResponse { /// Set response's payload pub fn set_payload>(mut self, data: B) -> Self { - let (_, mut payload) = h1::Payload::create(true); - payload.unread_data(data.into()); - self.payload = Some(payload.into()); + self.payload = Some(Payload::from(data.into())); self }