httper

Crates.iohttper
lib.rshttper
version0.1.0
sourcesrc
created_at2018-08-10 11:58:54.637639
updated_at2018-08-10 11:58:54.637639
descriptionHTTP(S) requests made easy
homepage
repositoryhttps://github.com/drager/httper
max_upload_size
id78661
size43,356
Jesper HÃ¥kansson (drager)

documentation

https://docs.rs/httper

README

HTTPer

Build Status

A asynchronous HTTP(S) client built on top of hyper.

Why

At the time when I started writting parts of this client I couldn't find any higher level asynchronous http(s) client. I also tended to write the same code over and over again for serveral different projects based on hyper, always wanted to be able to make requests to https addresses and deserialize the response body into json.

Usage

A simple usage 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,
    }

    // Call .send() to fire the request and then call .json::<Vec<Contributor>>()
    // to turn the json response into a Vec containing Contributor.
    let result = rt.block_on(
        httper_client
            .get("https://api.github.com/repos/drager/httper/contributors")
            .send()
            .json::<Vec<Contributor>>(),
    );

    println!("Contributors: {:?}", result);
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

Licensed under either of:

Commit count: 49

cargo fmt