#http

http

A set of types for representing HTTP requests and responses

25 releases

✓ Uses Rust 2018 edition

0.2.1 Mar 25, 2020
0.2.0 Dec 2, 2019
0.1.21 Dec 2, 2019
0.1.20 Nov 26, 2019
0.0.0-prealpha Nov 20, 2014

#1 in Web programming

Download history 117406/week @ 2019-12-17 67652/week @ 2019-12-24 89437/week @ 2019-12-31 142527/week @ 2020-01-07 137534/week @ 2020-01-14 148563/week @ 2020-01-21 151262/week @ 2020-01-28 146567/week @ 2020-02-04 135385/week @ 2020-02-11 133608/week @ 2020-02-18 143603/week @ 2020-02-25 145914/week @ 2020-03-03 144887/week @ 2020-03-10 149044/week @ 2020-03-17 155752/week @ 2020-03-24 149993/week @ 2020-03-31

585,759 downloads per month
Used in 2,761 crates (429 directly)

MIT/Apache

425KB
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.2"

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

~185KB