pub trait HttpServiceExt<Body>: Sized {
// Provided methods
fn request_bytes_to_body(self) -> BytesToBodyRequest<Self> { ... }
fn response_body_to_bytes(self) -> BodyToBytesResponse<Self> { ... }
fn json_response<T>(self) -> JsonResponse<Self, T> { ... }
fn json_request<T>(self) -> JsonRequest<Self, T> { ... }
fn form_urlencoded_request<T>(self) -> FormUrlencodedRequest<Self, T> { ... }
fn catch_http_code<M, ResBody, E>(
self,
status_code: StatusCode,
mapper: M,
) -> CatchHttpCodes<Self, M>
where M: Fn(Response<ResBody>) -> E + Send + Clone + 'static { ... }
fn catch_http_codes<B, M, ResBody, E>(
self,
bounds: B,
mapper: M,
) -> CatchHttpCodes<Self, M>
where B: RangeBounds<StatusCode>,
M: Fn(Response<ResBody>) -> E + Send + Clone + 'static { ... }
fn catch_http_errors<M, ResBody, E>(
self,
mapper: M,
) -> CatchHttpCodes<Self, M>
where M: Fn(Response<ResBody>) -> E + Send + Clone + 'static { ... }
}
Provided Methods§
fn request_bytes_to_body(self) -> BytesToBodyRequest<Self>
Sourcefn response_body_to_bytes(self) -> BodyToBytesResponse<Self>
fn response_body_to_bytes(self) -> BodyToBytesResponse<Self>
Adds a layer which collects all the response body into a contiguous
byte buffer.
This makes the response type Response<Bytes>
.
fn json_response<T>(self) -> JsonResponse<Self, T>
fn json_request<T>(self) -> JsonRequest<Self, T>
fn form_urlencoded_request<T>(self) -> FormUrlencodedRequest<Self, T>
Sourcefn catch_http_code<M, ResBody, E>(
self,
status_code: StatusCode,
mapper: M,
) -> CatchHttpCodes<Self, M>
fn catch_http_code<M, ResBody, E>( self, status_code: StatusCode, mapper: M, ) -> CatchHttpCodes<Self, M>
Catches responses with the given status code and then maps those
responses to an error type using the provided mapper
function.
Sourcefn catch_http_codes<B, M, ResBody, E>(
self,
bounds: B,
mapper: M,
) -> CatchHttpCodes<Self, M>
fn catch_http_codes<B, M, ResBody, E>( self, bounds: B, mapper: M, ) -> CatchHttpCodes<Self, M>
Catches responses with the given status codes and then maps those
responses to an error type using the provided mapper
function.
Sourcefn catch_http_errors<M, ResBody, E>(self, mapper: M) -> CatchHttpCodes<Self, M>
fn catch_http_errors<M, ResBody, E>(self, mapper: M) -> CatchHttpCodes<Self, M>
Shorthand for Self::catch_http_codes
which catches all client errors
(4xx) and server errors (5xx).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.