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}, jsonrpc::{Envelope, RpcClient, RpcClientError, SignalMessage, connect_tcp},
prometheus::{Prometheus, PrometheusConfig}, prometheus::{Prometheus, PrometheusConfig},
}; };
use tokio_util::bytes::Buf;
use conf::{Conf, Subcommands}; use conf::{Conf, Subcommands};
use futures_util::FutureExt; use futures_util::FutureExt;
use http::{Method, Request, Response, StatusCode}; use http::{Method, Request, Response, StatusCode};
use http_body::Body; use http_body::Body;
use http_body_util::BodyExt; use http_body_util::BodyExt;
use prometheus_http_client::{AlertStatus, ExtractLabels}; use prometheus_http_client::{AlertStatus, ExtractLabels};
use tokio_util::bytes::Buf;
//use jsonrpsee::async_client::{Client as JsonRpcClient, Error as JsonRpcError}; //use jsonrpsee::async_client::{Client as JsonRpcClient, Error as JsonRpcError};
use chrono::Utc; use chrono::Utc;
use std::{ use std::{
@@ -419,15 +419,21 @@ impl Gateway {
match req.uri().path() { match req.uri().path() {
"/" | "/health" | "/ready" => { "/" | "/health" | "/ready" => {
if !matches!(req.method(), Method::GET | Method::HEAD) { if !matches!(req.method(), &Method::GET | &Method::HEAD) {
Ok(err_resp(StatusCode::UNIMPLEMENTED, "Use GET or HEAD with this route")) Ok(err_resp(
StatusCode::NOT_IMPLEMENTED,
"Use GET or HEAD with this route",
))
} else { } else {
Ok(ok_resp()) Ok(ok_resp())
} }
}, }
"/alert" => { "/alert" => {
if !matches!(req.method(), Method::POST) { if !matches!(req.method(), &Method::POST) {
return Ok(err_resp(StatusCode::UNIMPLEMENTED, "Use POST with this route")); return Ok(err_resp(
StatusCode::NOT_IMPLEMENTED,
"Use POST with this route",
));
} }
let v = req let v = req
.into_body() .into_body()
@@ -442,7 +448,7 @@ impl Gateway {
} else { } else {
Ok(ok_resp()) Ok(ok_resp())
} }
}, }
_ => Ok(err_resp( _ => Ok(err_resp(
StatusCode::NOT_FOUND, StatusCode::NOT_FOUND,
format!("Not found '{} {}'", req.method(), req.uri().path()), format!("Not found '{} {}'", req.method(), req.uri().path()),
+1 -1
View File
@@ -1,8 +1,8 @@
pub mod alertmanager; pub mod alertmanager;
pub mod gateway; pub mod gateway;
pub(crate) mod jsonrpc;
pub(crate) mod human_duration; pub(crate) mod human_duration;
pub(crate) mod jsonrpc;
pub(crate) mod prometheus; pub(crate) mod prometheus;
pub(crate) mod transports; pub(crate) mod transports;