Skip to content

Commit

Permalink
feature: Add user agent to requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcyrd authored and anthraxx committed Mar 29, 2021
1 parent 2032fff commit d0c2ec3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use term::{color, Attr};
use term::{StdoutTerminal, TerminfoTerminal};
use url::Url;

static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);

#[tokio::main]
async fn main() {
let args = Args::from_args();
Expand Down Expand Up @@ -125,7 +127,7 @@ async fn get_avg_json(config: &Config) -> Result<String> {
async fn fetch_avg_json(url: &Url, config: &Config) -> Result<String> {
info!("Downloading AVGs from {}", url);

let mut client = ClientBuilder::new();
let mut client = ClientBuilder::new().user_agent(APP_USER_AGENT);
if let Some(proxy) = &config.proxy {
let proxy = Proxy::all(proxy)?;
client = client.proxy(proxy);
Expand Down

0 comments on commit d0c2ec3

Please sign in to comment.