Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn call<'life0, 'async_trait>(
        &'life0 self,
        request: HttpRequest,
    ) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An HTTP client capable of executing the requests made by MinecraftAuthorizationFlow.

The trait is asynchronous by default and becomes synchronous when the is_sync feature is enabled. Implementations should be annotated with maybe_async::maybe_async to support both modes.

An implementation for reqwest::Client ([reqwest::blocking::Client] with is_sync) is provided behind the reqwest feature, which is enabled by default.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned when a request fails at the transport level.

Required Methods§

Source

fn call<'life0, 'async_trait>( &'life0 self, request: HttpRequest, ) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Executes the given request, returning the response with its full body.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl HttpClient for Client

Source§

type Error = Error

Source§

fn call<'life0, 'async_trait>( &'life0 self, request: HttpRequest, ) -> Pin<Box<dyn Future<Output = Result<HttpResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§