mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-06 04:00:02 +00:00
Rename new_reqwest_client
> get_reqwest_client
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
6582eefd25
commit
5ad572fa42
2 changed files with 5 additions and 5 deletions
|
@ -7,7 +7,7 @@ use tokio::task::JoinHandle;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use super::Data;
|
use super::Data;
|
||||||
use crate::{download_and_extract, new_reqwest_client, remote_exists, BinstallError, PkgFmt};
|
use crate::{download_and_extract, get_reqwest_client, remote_exists, BinstallError, PkgFmt};
|
||||||
|
|
||||||
const BASE_URL: &str = "https://github.com/alsuren/cargo-quickinstall/releases/download";
|
const BASE_URL: &str = "https://github.com/alsuren/cargo-quickinstall/releases/download";
|
||||||
const STATS_URL: &str = "https://warehouse-clerk-tmp.vercel.app/api/crate";
|
const STATS_URL: &str = "https://warehouse-clerk-tmp.vercel.app/api/crate";
|
||||||
|
@ -88,7 +88,7 @@ impl QuickInstall {
|
||||||
let url = Url::parse(&stats_url)?;
|
let url = Url::parse(&stats_url)?;
|
||||||
debug!("Sending installation report to quickinstall ({url})");
|
debug!("Sending installation report to quickinstall ({url})");
|
||||||
|
|
||||||
new_reqwest_client()
|
get_reqwest_client()
|
||||||
.request(Method::HEAD, url.clone())
|
.request(Method::HEAD, url.clone())
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -80,12 +80,12 @@ pub fn initialize_reqwest_client(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_reqwest_client() -> &'static Client {
|
pub fn get_reqwest_client() -> &'static Client {
|
||||||
CLIENT.get().expect("Reqwest client is not initialized")
|
CLIENT.get().expect("Reqwest client is not initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn remote_exists(url: Url, method: Method) -> Result<bool, BinstallError> {
|
pub async fn remote_exists(url: Url, method: Method) -> Result<bool, BinstallError> {
|
||||||
let req = new_reqwest_client()
|
let req = get_reqwest_client()
|
||||||
.request(method.clone(), url.clone())
|
.request(method.clone(), url.clone())
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
|
@ -98,7 +98,7 @@ async fn create_request(
|
||||||
) -> Result<impl Stream<Item = reqwest::Result<Bytes>>, BinstallError> {
|
) -> Result<impl Stream<Item = reqwest::Result<Bytes>>, BinstallError> {
|
||||||
debug!("Downloading from: '{url}'");
|
debug!("Downloading from: '{url}'");
|
||||||
|
|
||||||
new_reqwest_client()
|
get_reqwest_client()
|
||||||
.get(url.clone())
|
.get(url.clone())
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue