38 releases (2 stable)

1.1.0 Mar 4, 2024
1.0.0 Nov 15, 2023
0.2.12 Mar 4, 2024
0.2.11 Nov 13, 2023
0.0.0-prealpha Nov 20, 2014

#4 in Web programming

Download history 1373232/week @ 2024-01-06 1440026/week @ 2024-01-13 1548600/week @ 2024-01-20 1664044/week @ 2024-01-27 1709780/week @ 2024-02-03 1721954/week @ 2024-02-10 1722649/week @ 2024-02-17 1821397/week @ 2024-02-24 1992928/week @ 2024-03-02 1940139/week @ 2024-03-09 1956782/week @ 2024-03-16 1927044/week @ 2024-03-23 1964326/week @ 2024-03-30 1995210/week @ 2024-04-06 2035701/week @ 2024-04-13 1744216/week @ 2024-04-20

8,016,758 downloads per month
Used in 20,426 crates (3,211 directly)

MIT/Apache

440KB
7.5K SLoC

HTTP

A general purpose library of common HTTP types

CI 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 = "1.0"

Next, add this to your crate:

use http::{Request, Response};

fn main() {
    // ...
}

Examples

Create an HTTP request:

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:

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();
}

Supported Rust Versions

This project follows the Tokio MSRV and is currently set to 1.49.

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

~200KB