Trait tower_web::util::http::HttpMiddleware [−][src]
pub trait HttpMiddleware<S>: Sealed<S> {
type RequestBody: BufStream;
type ResponseBody: BufStream;
type Error;
type Service: HttpService<RequestBody = Self::RequestBody, ResponseBody = Self::ResponseBody, Error = Self::Error>;
fn wrap_http(&self, inner: S) -> Self::Service;
}HTTP middleware trait
A trait "alias" for Middleware where the yielded service is an
HttpService.
Using HttpMiddleware in where bounds is easier than trying to use Middleware
directly.
Associated Types
type RequestBody: BufStream
The HTTP request body handled by the wrapped service.
type ResponseBody: BufStream
The HTTP response body returned by the wrapped service.
type Error
The wrapped service's error type.
type Service: HttpService<RequestBody = Self::RequestBody, ResponseBody = Self::ResponseBody, Error = Self::Error>
The wrapped service.
Required Methods
fn wrap_http(&self, inner: S) -> Self::Service
Wrap the given service with the middleware, returning a new servicee that has been decorated with the middleware.
Implementors
impl<T, S, B1, B2> HttpMiddleware<S> for T where
T: Middleware<S, Request = Request<B1>, Response = Response<B2>>,
B1: BufStream,
B2: BufStream, type RequestBody = B1; type ResponseBody = B2; type Error = T::Error; type Service = T::Service;