diff --git a/src/bin/basic_auth.rs b/src/bin/basic_auth.rs new file mode 100644 index 0000000..1f955d0 --- /dev/null +++ b/src/bin/basic_auth.rs @@ -0,0 +1,19 @@ +use error_chain::error_chain; +use reqwest::blocking::Client; + +error_chain! { + foreign_links { + Io(std::io::Error); + HttpError(reqwest::Error); + } +} + +fn main() -> Result<()> { + let client = Client::new(); + let user = String::from("testuser"); + let passwd = Option::::None; + let url = format!("https://httpbin.org/get"); + let response = client.get(&url).basic_auth(user, passwd).send()?; + println!("{:?}", response); + Ok(()) +}