mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-06 04:00:02 +00:00
Refactor: Mv debug!
into create_request
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
ad41756daa
commit
74a6e137be
1 changed files with 2 additions and 4 deletions
|
@ -52,6 +52,8 @@ pub async fn remote_exists(url: Url, method: Method) -> Result<bool, BinstallErr
|
||||||
async fn create_request(
|
async fn create_request(
|
||||||
url: Url,
|
url: Url,
|
||||||
) -> Result<impl Stream<Item = reqwest::Result<Bytes>>, BinstallError> {
|
) -> Result<impl Stream<Item = reqwest::Result<Bytes>>, BinstallError> {
|
||||||
|
debug!("Downloading from: '{url}'");
|
||||||
|
|
||||||
reqwest::get(url.clone())
|
reqwest::get(url.clone())
|
||||||
.await
|
.await
|
||||||
.and_then(|r| r.error_for_status())
|
.and_then(|r| r.error_for_status())
|
||||||
|
@ -69,8 +71,6 @@ pub async fn download_and_extract<P: AsRef<Path>>(
|
||||||
fmt: PkgFmt,
|
fmt: PkgFmt,
|
||||||
path: P,
|
path: P,
|
||||||
) -> Result<(), BinstallError> {
|
) -> Result<(), BinstallError> {
|
||||||
debug!("Downloading from: '{url}'");
|
|
||||||
|
|
||||||
let stream = create_request(url).await?;
|
let stream = create_request(url).await?;
|
||||||
|
|
||||||
let path = path.as_ref();
|
let path = path.as_ref();
|
||||||
|
@ -97,8 +97,6 @@ pub async fn download_tar_based_and_visit<V: TarEntriesVisitor + Debug + Send +
|
||||||
fmt: TarBasedFmt,
|
fmt: TarBasedFmt,
|
||||||
visitor: V,
|
visitor: V,
|
||||||
) -> Result<V, BinstallError> {
|
) -> Result<V, BinstallError> {
|
||||||
debug!("Downloading from: '{url}'");
|
|
||||||
|
|
||||||
let stream = create_request(url).await?;
|
let stream = create_request(url).await?;
|
||||||
|
|
||||||
debug!("Downloading and extracting then in-memory processing");
|
debug!("Downloading and extracting then in-memory processing");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue