cargo fmt

This commit is contained in:
Chris Beck
2025-12-05 01:45:10 -07:00
parent da502583ad
commit f97c6331ba
2 changed files with 14 additions and 8 deletions
+13 -7
View File
@@ -3,13 +3,13 @@ use crate::{
jsonrpc::{Envelope, RpcClient, RpcClientError, SignalMessage, connect_tcp},
prometheus::{Prometheus, PrometheusConfig},
};
use tokio_util::bytes::Buf;
use conf::{Conf, Subcommands};
use futures_util::FutureExt;
use http::{Method, Request, Response, StatusCode};
use http_body::Body;
use http_body_util::BodyExt;
use prometheus_http_client::{AlertStatus, ExtractLabels};
use tokio_util::bytes::Buf;
//use jsonrpsee::async_client::{Client as JsonRpcClient, Error as JsonRpcError};
use chrono::Utc;
use std::{
@@ -419,15 +419,21 @@ impl Gateway {
match req.uri().path() {
"/" | "/health" | "/ready" => {
if !matches!(req.method(), Method::GET | Method::HEAD) {
Ok(err_resp(StatusCode::UNIMPLEMENTED, "Use GET or HEAD with this route"))
if !matches!(req.method(), &Method::GET | &Method::HEAD) {
Ok(err_resp(
StatusCode::NOT_IMPLEMENTED,
"Use GET or HEAD with this route",
))
} else {
Ok(ok_resp())
}
},
}
"/alert" => {
if !matches!(req.method(), Method::POST) {
return Ok(err_resp(StatusCode::UNIMPLEMENTED, "Use POST with this route"));
if !matches!(req.method(), &Method::POST) {
return Ok(err_resp(
StatusCode::NOT_IMPLEMENTED,
"Use POST with this route",
));
}
let v = req
.into_body()
@@ -442,7 +448,7 @@ impl Gateway {
} else {
Ok(ok_resp())
}
},
}
_ => Ok(err_resp(
StatusCode::NOT_FOUND,
format!("Not found '{} {}'", req.method(), req.uri().path()),
+1 -1
View File
@@ -1,8 +1,8 @@
pub mod alertmanager;
pub mod gateway;
pub(crate) mod jsonrpc;
pub(crate) mod human_duration;
pub(crate) mod jsonrpc;
pub(crate) mod prometheus;
pub(crate) mod transports;