summaryrefslogtreecommitdiffstats
path: root/src/service/http.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/http.rs')
-rw-r--r--src/service/http.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/service/http.rs b/src/service/http.rs
index 7c875b9..8950096 100644
--- a/src/service/http.rs
+++ b/src/service/http.rs
@@ -32,14 +32,10 @@ impl ServiceSpawner for Http {
.try_clone()
.expect("Clone with no body should never fail");
let resp = client.execute(req).await;
- let status = match resp.map(|r| r.status().as_u16()) {
- Ok(code) if code == self.status_code => Status::Pass,
- Ok(code) => Status::Fail(Some(format!("Status code: {code}"))),
- Err(err) => {
- tracing::error!("HTTP request error: {err}");
- Status::Unknown
- }
- };
+ let status = resp.map_or_else(Into::into, |r| match r.status().as_u16() {
+ c if c == self.status_code => Status::Ok,
+ c => Status::Error(Some(format!("Status code: {c}"))),
+ });
tx.send_if_modified(|s| s.update(status));
}