Expand description
Minimal and straightforward HTTP(s) request library (with server)
Usage:
use mashrl::{http, make_get_request};
use std::io::Read;
fn main() {
let mut response = make_get_request("httpbin.org", "get", http::Headers::empty()).unwrap();
eprintln!("Code {code}", code = response.code.0);
for (key, value) in &response.headers {
eprintln!("{key}: {value}");
}
let mut content = String::new();
response.body.get_reader(&response.headers).read_to_string(&mut content).unwrap();
eprintln!("{content}");
}Features
- Simple to use API
- Header creation and parsing API
- Chunked decoding
- Gzip decompression (under
-F decompress)
Future
- Specify port (default to
443, the standard for internet traffic) - Improvements to body handling (auto
Content-Lengthheader?) - Tracing (under flag)?
- HTTPS under flag?
Modules§
Functions§
- make_
get_ request - Errors
- make_
request - TODO request like.
(&str, &str)etc.