From 9a7c24acbd8b21af26242e2d60319cada2a59fb5 Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 1 Jan 2023 20:57:48 +0100 Subject: [PATCH] add apprise_ok --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 084eb0c..813d83e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use std::net::SocketAddr; use askama::Template; use axum::{ extract::State, - routing::post, + routing::{get, post}, http::StatusCode, response::{IntoResponse, Response}, Json, Router, @@ -67,6 +67,12 @@ async fn apprise_notification( .await } +async fn apprise_ok( +) -> Response { + ([("content-type", "application/json")], "{}") + .into_response() +} + #[derive(Deserialize)] struct Config { listen_port: u16, @@ -91,7 +97,7 @@ async fn main() { // build our application with a route let app = Router::new() .route("/alert", post(prometheus_alerts)) - .route("/notify", post(apprise_notification)) + .route("/notify", get(apprise_ok).post(apprise_notification)) .with_state(jabber); let addr = SocketAddr::from(([127, 0, 0, 1], config.listen_port));