commit | e5dd791587a3ff148e1d9716866974bf9e9655c1 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Fri Nov 10 02:11:44 2023 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Fri Nov 10 02:11:44 2023 +0000 |
tree | abe9ec99da51b98bfd7761f40e0107b5f9c974ce | |
parent | d91868074fb3965bf86b494de98814af24b79c41 [diff] | |
parent | c3fe4898c1d1564f2d5052d55e21356d852597b0 [diff] |
Snap for 11079393 from c3fe4898c1d1564f2d5052d55e21356d852597b0 to 24D1-release Change-Id: I6d28810e4a8eb7eefe07bc83135d8e716dfa66d8
A general purpose library of common HTTP types
More information about this crate can be found in the crate documentation.
To use http
, first add this to your Cargo.toml
:
[dependencies] http = "0.2"
Next, add this to your crate:
use http::{Request, Response}; fn main() { // ... }
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(); }
This project follows the Tokio MSRV and is currently set to 1.49
.
Licensed under either of
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.