• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H03-May-2022-7861

benches/H03-May-2022-990798

src/H03-May-2022-13,9867,410

tests/H03-May-2022-1,044844

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.gitignoreH A D01-Jan-197018 32

CHANGELOG.mdH A D01-Jan-19706.7 KiB178124

Cargo.tomlH A D01-Jan-19701.7 KiB7358

Cargo.toml.orig-cargoH A D01-Jan-19701.1 KiB5749

LICENSE-APACHEH A D01-Jan-197010.6 KiB202169

LICENSE-MITH A D01-Jan-19701 KiB2622

README.mdH A D01-Jan-19701.6 KiB8155

README.md

1# HTTP
2
3A general purpose library of common HTTP types
4
5[![CI](https://github.com/hyperium/http/workflows/CI/badge.svg)](https://github.com/hyperium/http/actions?query=workflow%3ACI)
6[![Crates.io](https://img.shields.io/crates/v/http.svg)](https://crates.io/crates/http)
7[![Documentation](https://docs.rs/http/badge.svg)][dox]
8
9More information about this crate can be found in the [crate
10documentation][dox].
11
12[dox]: https://docs.rs/http
13
14## Usage
15
16To use `http`, first add this to your `Cargo.toml`:
17
18```toml
19[dependencies]
20http = "0.2"
21```
22
23Next, add this to your crate:
24
25```rust
26extern crate http;
27
28use http::{Request, Response};
29
30fn main() {
31    // ...
32}
33```
34
35## Examples
36
37Create an HTTP request:
38
39```rust
40extern crate http;
41
42use http::Request;
43
44fn main() {
45    let request = Request::builder()
46      .uri("https://www.rust-lang.org/")
47      .header("User-Agent", "awesome/1.0")
48      .body(())
49      .unwrap();
50}
51```
52
53Create an HTTP response:
54
55```rust
56extern crate http;
57
58use http::{Response, StatusCode};
59
60fn main() {
61    let response = Response::builder()
62      .status(StatusCode::MOVED_PERMANENTLY)
63      .header("Location", "https://www.rust-lang.org/install.html")
64      .body(())
65      .unwrap();
66}
67```
68
69# License
70
71Licensed under either of
72
73- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://apache.org/licenses/LICENSE-2.0)
74- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
75
76# Contribution
77
78Unless you explicitly state otherwise, any contribution intentionally submitted
79for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
80dual licensed as above, without any additional terms or conditions.
81