mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 21:48:42 +00:00
Only use GET
in remote::Client::remote_gettable
(#847)
Fixed #835 Using `HEAD` for this would often cause false negative that requires the `Client` to fallback to `GET`, which creates a lot of requests even if the url doesn't exist and then get cargo-binstall rate limited by GitHub/GitLab/etc. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
8eee318ccd
commit
75289cc2b4
1 changed files with 2 additions and 4 deletions
|
@ -279,11 +279,9 @@ impl Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if remote exists using `Method::HEAD` or `Method::GET` as fallback.
|
/// Check if remote exists using `Method::GET`.
|
||||||
pub async fn remote_gettable(&self, url: Url) -> Result<bool, Error> {
|
pub async fn remote_gettable(&self, url: Url) -> Result<bool, Error> {
|
||||||
self.head_or_fallback_to_get(url, false)
|
Ok(self.get(url).send(false).await?.status().is_success())
|
||||||
.await
|
|
||||||
.map(|response| response.status().is_success())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempt to get final redirected url using `Method::HEAD` or fallback
|
/// Attempt to get final redirected url using `Method::HEAD` or fallback
|
||||||
|
|
Loading…
Add table
Reference in a new issue