Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Return an error when download_input fails #485

Merged
5 commits merged into from
Jan 29, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/agent/onefuzz-agent/src/tasks/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use anyhow::Result;
use async_trait::async_trait;
use onefuzz::jitter::delay_with_jitter;
use onefuzz::{http::ResponseExt, jitter::delay_with_jitter};
use reqwest::Url;
use std::path::{Path, PathBuf};
use std::time::Duration;
Expand All @@ -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_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 mut body = body.as_ref();
Expand Down