Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/HTTPS-Authenticated/Rust/https-authenticated.rust
Normal file
20
Task/HTTPS-Authenticated/Rust/https-authenticated.rust
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
extern crate reqwest;
|
||||
|
||||
use reqwest::blocking::Client;
|
||||
use reqwest::header::CONNECTION;
|
||||
|
||||
fn main() {
|
||||
let client = Client::new();
|
||||
|
||||
// reqwest uses strongly-typed structs for creating headers
|
||||
let res = client
|
||||
.get("https://www.example.com")
|
||||
.basic_auth("user", Some("password"))
|
||||
.header(CONNECTION, "close")
|
||||
.send()
|
||||
.unwrap();
|
||||
|
||||
let body = res.text().unwrap();
|
||||
|
||||
println!("{}", body);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue