mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 04:38:09 +00:00
Return an error when download_input fails (#485)
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use onefuzz::jitter::delay_with_jitter;
|
use onefuzz::{http::ResponseExt, jitter::delay_with_jitter};
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -13,7 +13,10 @@ pub async fn download_input(input_url: Url, dst: impl AsRef<Path>) -> Result<Pat
|
|||||||
let file_name = input_url.path_segments().unwrap().last().unwrap();
|
let file_name = input_url.path_segments().unwrap().last().unwrap();
|
||||||
let file_path = dst.as_ref().join(file_name);
|
let file_path = dst.as_ref().join(file_name);
|
||||||
|
|
||||||
let resp = reqwest::get(input_url).await?;
|
let resp = reqwest::get(input_url)
|
||||||
|
.await?
|
||||||
|
.error_for_status_with_body()
|
||||||
|
.await?;
|
||||||
|
|
||||||
let body = resp.bytes().await?;
|
let body = resp.bytes().await?;
|
||||||
let mut body = body.as_ref();
|
let mut body = body.as_ref();
|
||||||
|
Reference in New Issue
Block a user