Skip to content
Snippets Groups Projects
Commit d3148c92 authored by Emanuele Aina's avatar Emanuele Aina
Browse files

storage_stats: Actually check the HTTP status code


By default reqwest does not return an actual error for non-success HTTP
status codes like HTTP 404.

This lead to parser failures when trying to read the HTML error message
from a 404 reply as a deb822 document.

Use `Response::error_for_status()` to actually check for successful
status codes.

Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent 5569c481
No related branches found
No related tags found
No related merge requests found
Pipeline #378199 failed
This commit is part of merge request !111. Comments created here will be created in the context of that merge request.
......@@ -60,7 +60,7 @@ impl Client {
#[instrument(skip(self))]
pub async fn get<U: IntoUrl + Clone + Debug>(&self, url: U) -> Result<Bytes> {
let result = retry(ExponentialBackoff::default(), || async {
self.get_no_retry(url.clone()).await.map_err(|err| {
self.get_no_retry(url.clone()).await.error_for_status().map_err(|err| {
// Don't treat 404s as transient (because they're usually not + it can be
// handled in a higher layer to find the first file available).
if is_error_404(&err) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment