mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00
Correct HTTP error for remote_exists() helper
This commit is contained in:
parent
c83c184983
commit
dee45f4b81
1 changed files with 7 additions and 2 deletions
|
@ -29,8 +29,13 @@ pub fn load_manifest_path<P: AsRef<Path>>(
|
||||||
Ok(manifest)
|
Ok(manifest)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn remote_exists(url: &str, method: reqwest::Method) -> Result<bool, BinstallError> {
|
pub async fn remote_exists(url: &str, method: Method) -> Result<bool, BinstallError> {
|
||||||
let req = reqwest::Client::new().request(method, url).send().await?;
|
let url = Url::parse(url)?;
|
||||||
|
let req = reqwest::Client::new()
|
||||||
|
.request(method.clone(), url.clone())
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|err| BinstallError::Http { method, url, err })?;
|
||||||
Ok(req.status().is_success())
|
Ok(req.status().is_success())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue