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

    // Required method
    fn send(
        &self,
        req: Request<RequestBody<'_, Self::BodyWriter>>
    ) -> Result<Response<Self::ResponseBody>, Error>;
}
Expand description

A trait implemented by HTTP client implementations.

Required Associated Types§

source

type BodyWriter

The client’s binary request write type.

source

type ResponseBody: Iterator<Item = Result<Bytes, Error>>

The client’s binary response body type.

Required Methods§

source

fn send( &self, req: Request<RequestBody<'_, Self::BodyWriter>> ) -> Result<Response<Self::ResponseBody>, Error>

Makes an HTTP request.

The request’s URI will be in absolute-form and it will always contain an Endpoint object in its extensions.

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§