Rust - HTTPS client for self signed certificate

less than 1 minute read

reqwest is a HTTP client in Rust.
https://github.com/seanmonstar/reqwest

It supports to send a HTTP request for self signed certificate site as shown in below.

Full source code can be found from the below github including http server/client.

https://github.com/nsclass/rust-https-server-client

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let res = reqwest::Client::builder()
        .danger_accept_invalid_certs(true)
        .build()
        .unwrap()
        .get("https://localhost:8088/")
        .send()
        .await?;

    println!("res: is {}", res.status());

    Ok(())
}

Categories:

Updated: