Skip to content

Commit

Permalink
fix: latency url empty
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzgydi committed Nov 1, 2023
1 parent 5a0fed9 commit 7e3a85e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src-tauri/src/core/clash_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ pub struct DelayRes {
pub async fn get_proxy_delay(name: String, test_url: Option<String>) -> Result<DelayRes> {
let (url, headers) = clash_client_info()?;
let url = format!("{url}/proxies/{name}/delay");
let test_url = test_url.unwrap_or("http://www.gstatic.com/generate_204".into());

let default_url = "http://www.gstatic.com/generate_204";
let test_url = test_url
.map(|s| if s.is_empty() { default_url.into() } else { s })
.unwrap_or(default_url.into());

let client = reqwest::ClientBuilder::new().no_proxy().build()?;
let builder = client
Expand Down

0 comments on commit 7e3a85e

Please sign in to comment.