Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient {
    // Required method
    fn request<'life0, 'async_trait>(
        &'life0 self,
        method: String,
        url: String,
        headers: Vec<(String, String)>,
        body: Option<Vec<u8>>,
    ) -> Pin<Box<dyn Future<Output = Result<HttpResponse, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Minimal async HTTP client trait.

Platform implementations provide the actual transport:

  • WASM: web_sys::fetch
  • Native: reqwest or similar

Required Methods§

Source

fn request<'life0, 'async_trait>( &'life0 self, method: String, url: String, headers: Vec<(String, String)>, body: Option<Vec<u8>>, ) -> Pin<Box<dyn Future<Output = Result<HttpResponse, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§