[][src]Module hyper::client

HTTP Client

There are two levels of APIs provided for construct HTTP clients:

Client

The Client is the main way to send HTTP requests to a server. The default Client provides these things on top of the lower-level API:

Many of these features can configured, by making use of Client::builder.

Example

For a small example program simply fetching a URL, take a look at the full client example.

use hyper::{body::HttpBody as _, Client, Uri};

let client = Client::new();

// Make a GET /ip to 'http://httpbin.org'
let res = client.get(Uri::from_static("http://httpbin.org/ip")).await?;

// And then, if the request gets a response...
println!("status: {}", res.status());

// Concatenate the body stream into a single buffer...
let buf = hyper::body::to_bytes(res).await?;

println!("body: {:?}", buf);

Modules

conn

Lower-level client connection API.

connect

Connectors used by the Client.

service

Utilities used to interact with the Tower ecosystem.

Structs

Builder

A builder to configure a new Client.

Client

A Client to make outgoing HTTP requests.

HttpConnector

A connector for the http scheme.

ResponseFuture

A Future that will resolve to an HTTP Response.