fix: latency url empty

This commit is contained in:
GyDi 2023-11-01 23:22:30 +08:00
parent 5a0fed9c93
commit 7e3a85e9da
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A

View File

@ -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