Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient {
    // Required method
    fn send(&self, request: Request<Body>, options: SendOptions) -> HttpFuture;
}
Expand description

Sends HTTP requests. One client outlives many requests, and every request may be in flight at once.

Required Methods§

Source

fn send(&self, request: Request<Body>, options: SendOptions) -> HttpFuture

Sends request. The answer arrives once the response’s head has, with its body still to read; dropping the future before then cancels the request.

A redirect that resends the request’s body — a 307 or a 308, or a 301 or a 302 of any method but POST — is followed only by a client that can send the body again: one that holds it, or Body::try_clone answered Some for it. A client that streams the body, as a WebAssembly component’s does, answers the redirect response instead, so the app can decide what to do with a body that is gone.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§