From b4e469d03a5b5d7d9014db1506c9801b80fc6e2e Mon Sep 17 00:00:00 2001
From: Ryan Gonzalez <ryan.gonzalez@collabora.com>
Date: Wed, 18 May 2022 15:17:14 -0500
Subject: [PATCH] Fix incorrect handling of HTTP error statuses

All non-2xx statuses were actually being ignored, because status codes
aren't propagated as errors by default.

https://phabricator.apertis.org/T8593

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
---
 storage_stats/src/client.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/storage_stats/src/client.rs b/storage_stats/src/client.rs
index e54adb2..0809a53 100644
--- a/storage_stats/src/client.rs
+++ b/storage_stats/src/client.rs
@@ -54,7 +54,7 @@ impl Client {
 
         // NOTE: the URL should be printed since get() is instrumented.
         debug!("GET");
-        Ok(self.client.get(url.clone()).send().await?.bytes().await?)
+        Ok(self.client.get(url.clone()).send().await?.error_for_status()?.bytes().await?)
     }
 
     #[instrument(skip(self))]
-- 
GitLab