Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient:
    Send
    + Sync
    + 'static {
    // Required method
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        request: HttpRequest,
    ) -> Pin<Box<dyn Future<Output = Result<HttpResponse, HttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Send a request, return a streaming response.

Contract:

  • HttpResponse::url must be the post-redirect URL — streamable-HTTP transports resolve relative endpoints against it.
  • The body must be surfaced as a stream, not buffered — SSE consumers pull chunks incrementally.
  • Use HttpError::Request for connect/transport failures, HttpError::Body for errors that surface mid-stream.

Required Methods§

Source

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

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§

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

Implementors§