pub trait HttpClient: Sync {
    type RequestBody: Default + BufMut + Send;
    type ResponseBody: AsRef<[u8]>;
    type Error: Send + Unpin;

    // Required method
    fn send_http_request<'life0, 'async_trait>(
        &'life0 self,
        req: Request<Self::RequestBody>
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ResponseBody>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An HTTP client that can be used to send requests to a Matrix homeserver.

Required Associated Types§

source

type RequestBody: Default + BufMut + Send

The type to use for try_into_http_request.

source

type ResponseBody: AsRef<[u8]>

The type to use for try_from_http_response.

source

type Error: Send + Unpin

The error type for the send_request function.

Required Methods§

source

fn send_http_request<'life0, 'async_trait>( &'life0 self, req: Request<Self::RequestBody> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ResponseBody>, Self::Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Send an http::Request to get back an http::Response.

Implementations on Foreign Types§

source§

impl<C> HttpClient for Client<C>where C: Connect + Clone + Send + Sync + 'static,

Available on crate feature hyper only.
§

type RequestBody = BytesMut

§

type ResponseBody = Bytes

§

type Error = Error

source§

fn send_http_request<'life0, 'async_trait>( &'life0 self, req: Request<BytesMut> ) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

source§

impl HttpClient for Isahc

Available on crate feature isahc only.
source§

impl HttpClient for Reqwest

Available on crate feature reqwest only.