17 releases
0.2.16 | Jul 17, 2021 |
---|---|
0.2.15 | Jul 17, 2021 |
0.2.14 | May 29, 2021 |
0.2.13 | Apr 30, 2021 |
0.1.16 |
|
#94 in #http-response
78 downloads per month
30KB
880 lines
http-protocol
Headers
extern crate http_protocol;
use http_protocol::header::Header;
use http_protocol::Headers;
fn main() {
let mut headers = Headers::new();
headers.insert(Header::Connection, &b"close"[..]);
println!("{:?}", headers);
}
Response
extern crate http_protocol;
use http_protocol::header::Header;
use http_protocol::{Body, Headers, HttpVersion, Response, StatusCode};
fn main() {
let mut headers = Headers::new();
headers.insert(Header::Connection, &b"close"[..]);
let mut response_builder = Response::builder();
response_builder
.http_version(HttpVersion::Http11)
.status_code(StatusCode::S200)
.headers(headers)
.body(Body::empty());
let response = response_builder.build().unwrap();
println!("{:?}", response);
}
Dependencies
~2.5–8MB
~60K SLoC