Add proxy support (#272)

* Add proxy support
This commit is contained in:
David Caseria
2024-08-07 08:53:05 -04:00
committed by GitHub
parent 6adf3267c0
commit 0945b3540a
7 changed files with 54 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ use anyhow::Result;
use cdk::url::UncheckedUrl;
use cdk::HttpClient;
use clap::Args;
use url::Url;
#[derive(Args)]
pub struct MintInfoSubcommand {
@@ -9,8 +10,11 @@ pub struct MintInfoSubcommand {
mint_url: UncheckedUrl,
}
pub async fn mint_info(sub_command_args: &MintInfoSubcommand) -> Result<()> {
let client = HttpClient::default();
pub async fn mint_info(proxy: Option<Url>, sub_command_args: &MintInfoSubcommand) -> Result<()> {
let client = match proxy {
Some(proxy) => HttpClient::with_proxy(proxy, None, true)?,
None => HttpClient::new(),
};
let info = client
.get_mint_info(sub_command_args.mint_url.clone().try_into()?)