psibase 0.28.0

Library and command-line tool for interacting with psibase networks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use reqwest::Url;

pub fn apply_proxy(
    builder: reqwest::ClientBuilder,
    proxy: &Option<Url>,
) -> Result<reqwest::ClientBuilder, anyhow::Error> {
    if let Some(url) = proxy {
        if url.scheme() == "unix" {
            Ok(builder.unix_socket(url.path()))
        } else {
            Ok(builder.proxy(reqwest::Proxy::http(url.as_str())?))
        }
    } else {
        Ok(builder)
    }
}