Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient: Send + Sync {
    // Required methods
    fn http_request(
        &self,
        params: HttpRequestParams,
    ) -> BoxFuture<'_, Result<HttpRequestResponse, ExecServerError>>;
    fn http_request_stream(
        &self,
        params: HttpRequestParams,
    ) -> BoxFuture<'_, Result<(HttpRequestResponse, HttpResponseBodyStream), ExecServerError>>;
}
Expand description

Sends HTTP requests through a runtime-selected transport.

This is the HTTP capability counterpart to crate::ExecBackend. Callers use it when they need environment-owned network requests but should not depend on the concrete connection type or how that connection is established.

Required Methods§

Source

fn http_request( &self, params: HttpRequestParams, ) -> BoxFuture<'_, Result<HttpRequestResponse, ExecServerError>>

Perform an HTTP request and buffer the response body.

Source

fn http_request_stream( &self, params: HttpRequestParams, ) -> BoxFuture<'_, Result<(HttpRequestResponse, HttpResponseBodyStream), ExecServerError>>

Perform an HTTP request and return a streamed body handle.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§