use http_req::{
request::{Authentication, Request},
uri::Uri,
};
fn main() {
let mut body = Vec::new();
let uri = Uri::try_from("https://httpbin.org/basic-auth/foo/bar").unwrap();
let auth = Authentication::basic("foo", "bar");
let res = Request::new(&uri)
.authentication(auth)
.send(&mut body)
.unwrap();
println!("Status: {} {}", res.status_code(), res.reason());
println!("Headers: {}", res.headers());
println!("{}", String::from_utf8_lossy(&body));
}