diff --git a/src/h1/service.rs b/src/h1/service.rs index c35d18714..fbc0a2f0f 100644 --- a/src/h1/service.rs +++ b/src/h1/service.rs @@ -11,6 +11,7 @@ use log::error; use crate::body::MessageBody; use crate::config::{KeepAlive, ServiceConfig}; use crate::error::{DispatchError, ParseError}; +use crate::payload::Payload; use crate::request::Request; use crate::response::Response; @@ -27,7 +28,7 @@ pub struct H1Service { impl H1Service where - S: NewService> + Clone, + S: NewService, Response = Response> + Clone, S::Service: Clone, S::Error: Debug, B: MessageBody, diff --git a/src/h2/dispatcher.rs b/src/h2/dispatcher.rs index 2994d0a3d..301777a82 100644 --- a/src/h2/dispatcher.rs +++ b/src/h2/dispatcher.rs @@ -21,10 +21,11 @@ use crate::body::{Body, BodyLength, MessageBody, ResponseBody}; use crate::config::ServiceConfig; use crate::error::{DispatchError, Error, ParseError, PayloadError, ResponseError}; use crate::message::ResponseHead; +use crate::payload::Payload; use crate::request::Request; use crate::response::Response; -use super::{H2ServiceResult, Payload}; +use super::H2ServiceResult; const CHUNK_SIZE: usize = 16_384; @@ -113,7 +114,7 @@ where } let (parts, body) = req.into_parts(); - let mut req = Request::with_payload(Payload::new(body)); + let mut req = Request::with_payload(body.into()); let head = &mut req.inner_mut().head; head.uri = parts.uri; diff --git a/src/h2/service.rs b/src/h2/service.rs index b598b0a6d..5759b55e2 100644 --- a/src/h2/service.rs +++ b/src/h2/service.rs @@ -14,11 +14,12 @@ use log::error; use crate::body::MessageBody; use crate::config::{KeepAlive, ServiceConfig}; use crate::error::{DispatchError, Error, ParseError, ResponseError}; +use crate::payload::Payload; use crate::request::Request; use crate::response::Response; use super::dispatcher::Dispatcher; -use super::{H2ServiceResult, Payload}; +use super::H2ServiceResult; /// `NewService` implementation for HTTP2 transport pub struct H2Service {