async-http-client 0.2.0

Asynchronous HTTP client

Crate async_http_client [] [src]

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());

Reexports

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.

HttpCodec

Codec that parses HTTP responses.

HttpRequest

Representation of an HTTP request.

HttpResponse

Representation of an HTTP response.

Enums

Method

Representation of an HTTP method.