Skip to main content

HttpTransport

Trait HttpTransport 

pub trait HttpTransport:
    Send
    + Sync
    + Unpin
    + 'static {
    // Required method
    fn fetch(
        &self,
        req: Request<Buffer>,
    ) -> impl Future<Output = Result<Response<HttpBody>, Error>> + Send;
}
Expand description

HTTP transport used by OpenDAL services.

Implement this trait to provide a custom HTTP backend. A transport must support 3xx redirection. It can support HttpRedirect to let services reuse redirect destinations.

Required Methods§

fn fetch( &self, req: Request<Buffer>, ) -> impl Future<Output = Result<Response<HttpBody>, Error>> + Send

Available on non-WebAssembly only.

Fetch a request and return a streamable HttpBody.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

§

impl HttpTransport for ReqwestTransport

§

async fn fetch(&self, req: Request<Buffer>) -> Result<Response<HttpBody>, Error>

Available on non-WebAssembly only.

Implementors§