Expand description
Asynchronous HTTP client.
§Installation
Add this to your Cargo.toml
:
[dependencies]
async-http-client = "0.2"
§Example
extern crate async_http_client;
use async_http_client::prelude::*;
use async_http_client::{HttpRequest, HttpCodec};
let req = HttpRequest::get("http://www.google.com").unwrap();
let mut core = Core::new().unwrap();
let addr = req.addr().unwrap();
let handle = core.handle();
let (res, framed) = core.run(TcpStream::connect(&addr, &handle).and_then(|connection| {
let framed = connection.framed(HttpCodec::new());
req.send(framed)
})).unwrap();
println!("got response {}", res.unwrap());
Re-exports§
pub extern crate futures;
pub extern crate tokio_core;
pub extern crate url;
Modules§
- prelude
- Commonly needed reexports from futures and tokio-core.
Structs§
- Header
- Representation of a header.
- Http
Codec - Codec that parses HTTP responses.
- Http
Request - Representation of an HTTP request.
- Http
Response - Representation of an HTTP response.
Enums§
- Method
- Representation of an HTTP method.