pub trait AsyncClient {
    type BodyWriter;
    type ResponseBody: Stream<Item = Result<Bytes, Error>>;

    fn send<'life0, 'life1, 'async_trait>(
        &'life0 self,
        req: Request<AsyncBody<'life1, Self::BodyWriter>>
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ResponseBody>, Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; }
Expand description

A trait implemented by async HTTP client implementations.

This trait can most easily be implemented with the async-trait crate.

Required Associated Types§

The client’s binary request body write type.

The client’s binary response body type.

Required Methods§

Makes an HTTP request.

The client is responsible for assembling the request URI. It is provided with the path template, unencoded path parameters, unencoded query parameters, header parameters, and request body.

A response must only be returned if it has a 2xx status code. The client is responsible for handling all other status codes (for example, converting a 5xx response into a service error). The client is also responsible for decoding the response body if necessary.

Implementors§