Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient:
    'static
    + Send
    + Sync {
    // Required methods
    fn user_agent(&self) -> Option<&HeaderValue>;
    fn proxy(&self) -> Option<&Url>;
    fn send(
        &self,
        req: Request<AsyncBody>,
    ) -> BoxFuture<'static, Result<Response<AsyncBody>>>;

    // Provided methods
    fn get(
        &self,
        uri: &str,
        body: AsyncBody,
        follow_redirects: bool,
    ) -> BoxFuture<'static, Result<Response<AsyncBody>>> { ... }
    fn post_json(
        &self,
        uri: &str,
        body: AsyncBody,
    ) -> BoxFuture<'static, Result<Response<AsyncBody>>> { ... }
}

Required Methods§

Source

fn user_agent(&self) -> Option<&HeaderValue>

Source

fn proxy(&self) -> Option<&Url>

Source

fn send( &self, req: Request<AsyncBody>, ) -> BoxFuture<'static, Result<Response<AsyncBody>>>

Provided Methods§

Source

fn get( &self, uri: &str, body: AsyncBody, follow_redirects: bool, ) -> BoxFuture<'static, Result<Response<AsyncBody>>>

Source

fn post_json( &self, uri: &str, body: AsyncBody, ) -> BoxFuture<'static, Result<Response<AsyncBody>>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§