use isahc::config::SslOption;
use isahc::prelude::*;
fn main() {
Request::get("https://expired.badssl.com")
.ssl_options(SslOption::DANGER_ACCEPT_INVALID_CERTS)
.body(())
.unwrap()
.send()
.expect("cert should have been accepted");
Request::get("https://wrong.host.badssl.com")
.ssl_options(SslOption::DANGER_ACCEPT_INVALID_CERTS)
.body(())
.unwrap()
.send()
.expect_err("cert should have been rejected");
Request::get("https://wrong.host.badssl.com")
.ssl_options(SslOption::DANGER_ACCEPT_INVALID_HOSTS)
.body(())
.unwrap()
.send()
.expect("cert should have been accepted");
Request::get("https://expired.badssl.com")
.ssl_options(SslOption::DANGER_ACCEPT_INVALID_HOSTS)
.body(())
.unwrap()
.send()
.expect_err("cert should have been rejected");
}