leyline-http 0.1.5

HTTP client that impersonates Chrome, Firefox, and Safari on the wire: TLS (JA3/JA4), HTTP/2, and HTTP/3 fingerprints
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use leyline::{Kind, Session};

#[tokio::test]
async fn an_invalid_environment_proxy_fails_closed() {
    // SAFETY: this binary holds one test on a current-thread runtime, so nothing reads the environment while it changes.
    unsafe {
        std::env::set_var("HTTPS_PROXY", "http://[::1");
        std::env::set_var("HTTP_PROXY", "http://[::1");
    }
    let err = Session::builder().build().unwrap_err();
    assert_eq!(err.kind(), Kind::Config, "{err:?}");
    let err = Session::new().get("http://127.0.0.1:9/").await.unwrap_err();
    assert_eq!(err.kind(), Kind::Proxy, "{err:?}");
}