#http

http

A set of types for representing HTTP requests and responses

17 releases

0.1.15 Jan 22, 2019
0.1.14 Nov 21, 2018
0.1.13 Sep 14, 2018
0.1.8 Jul 23, 2018
0.0.0-prealpha Nov 20, 2014

#2 in Web programming

Download history 16211/week @ 2018-10-10 15515/week @ 2018-10-17 20308/week @ 2018-10-24 20282/week @ 2018-10-31 18924/week @ 2018-11-07 18550/week @ 2018-11-14 20625/week @ 2018-11-21 24939/week @ 2018-11-28 26988/week @ 2018-12-05 25848/week @ 2018-12-12 17499/week @ 2018-12-19 16876/week @ 2018-12-26 24686/week @ 2019-01-02 27766/week @ 2019-01-09 29660/week @ 2019-01-16

95,873 downloads per month
Used in 875 crates (172 directly)

MIT/Apache

412KB
7K SLoC

HTTP

A general purpose library of common HTTP types

Build Status Crates.io Documentation

More information about this crate can be found in the crate documentation.

Usage

To use http, first add this to your Cargo.toml:

[dependencies]
http = "0.1"

Next, add this to your crate:

extern crate http;

use http::{Request, Response};

fn main() {
    // ...
}

Examples

Create an HTTP request:

extern crate http;

use http::Request;

fn main() {
    let request = Request::builder()
      .uri("https://www.rust-lang.org/")
      .header("User-Agent", "awesome/1.0")
      .body(())
      .unwrap();
}

Create an HTTP response:

extern crate http;

use http::{Response, StatusCode};

fn main() {
    let response = Response::builder()
      .status(StatusCode::MOVED_PERMANENTLY)
      .header("Location", "https://www.rust-lang.org/install.html")
      .body(())
      .unwrap();
}

License

Licensed under either of

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.

Dependencies

~419KB