ease 0.4.2

A library for building REST clients
docs.rs failed to build ease-0.4.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: ease-0.6.1

Ease - HTTP clients for Rust Build Status

Ease is a library for interacting with RESTful APIs.

Examples

In Cargo.toml, put:

[dependencies]
ease = "*"

Make a GET request and print the result:

extern crate ease;

use ease::{Url, Request};

fn main() {
    let url = Url::parse("http://httpbin.org/get").unwrap();
    println!("{}", Request::new(url).param("foo", "bar").get().unwrap().body);
}

Make a POST request and deserialize the response from JSON using serde:

#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]

extern crate ease;
extern crate serde;
extern crate serde_json;

use std::collections::HashMap;
use ease::{Url, Request};

#[derive(Deserialize, Debug)]
struct PostResponse {
    args: HashMap<String, String>,
    data: Option<String>,
    files: Option<HashMap<String, String>>,
    form: Option<HashMap<String, String>>,
    headers: HashMap<String, String>,
    json: Option<String>,
    origin: String,
    url: String,
}

fn main() {
    let url = Url::parse("http://httpbin.org/post").unwrap();
    println!("{:#?}", Request::new(url).post().and_then(|res| res.from_json::<PostResponse>()));
}

Documentation

Documentation is available online and can be built with cargo doc for a local copy.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.