Ease
is a library for interacting with RESTful APIs.
In Cargo.toml
, put:
toml
[dependencies]
ease = "*"
Make a GET request and print the result: ```rust 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: ```rust
extern crate ease; extern crate serde; extern crate serde_json;
use std::collections::HashMap; use ease::{Url, Request};
struct PostResponse {
args: HashMap
fn main() {
let url = Url::parse("http://httpbin.org/post").unwrap();
println!("{:#?}", Request::new(url).post().andthen(|res| res.jsonas::
Documentation is available online and can be built with cargo doc
for a local copy.
MIT