HTTPer client
In order to start making http(s) requests you need
to first initialize a HttperClient
and then construct
the http request with the method you want to use.
For example for DELETE
requests you call .delete()
on the HttperClient
instance and then you call .send()
to send the request. See below for an example.
extern crate httper;
extern crate tokio;
#[macro_use]
extern crate serde_derive;
use httper::client::HttperClient;
use tokio::runtime::Runtime;
fn main() {
let mut rt = Runtime::new().unwrap();
let httper_client = HttperClient::new();
#[derive(Debug, Deserialize)]
struct Contributor {
id: u32,
login: String,
}
let result = rt.block_on(
httper_client
.get("https://api.github.com/repos/drager/httper/contributors")
.send()
.json::<Vec<Contributor>>(),
);
println!("Contributors: {:?}", result);
}