fix: remove proxy and add top-level err msg

This commit is contained in:
Matthieu Bessat 2023-12-28 13:25:25 +01:00
parent 0f15e64ba2
commit 4184a0624c
4 changed files with 26 additions and 5 deletions

View file

@ -53,9 +53,10 @@ impl Client {
// decoy user agent
default_headers.insert("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0".parse().unwrap());
let proxy = reqwest::Proxy::https("https://localhost:8999").unwrap();
// TODO: configurable proxy
// let proxy = reqwest::Proxy::https("https://localhost:8999").unwrap();
reqwest::Client::builder()
.proxy(proxy)
// .proxy(proxy)
.default_headers(default_headers)
}

View file

@ -407,5 +407,14 @@ async fn launch_adapter() -> Result<()> {
#[tokio::main]
async fn main() {
// TODO: add argument parser to have handle config file
let _res = launch_adapter().await;
let res = launch_adapter().await;
match res {
Err(err) => {
eprintln!("Program failed, details bellow");
eprintln!("{:?}", err);
},
Ok(()) => {
eprintln!("Program done");
}
}
}

View file

@ -156,10 +156,11 @@ impl Client {
fn get_base_client_builder() -> reqwest::ClientBuilder {
let mut default_headers = reqwest::header::HeaderMap::new();
default_headers.insert("Accept", "application/json".parse().unwrap());
default_headers.insert("User-Agent", "helloasso_paheko_adapter".parse().unwrap());
let proxy = reqwest::Proxy::http("http://localhost:8998").unwrap();
// let proxy = reqwest::Proxy::http("http://localhost:8998").unwrap();
reqwest::Client::builder()
.proxy(proxy)
// .proxy(proxy)
.default_headers(default_headers)
}