diff --git a/src/handler/health.rs b/src/handler/health.rs index ec20384..8861505 100644 --- a/src/handler/health.rs +++ b/src/handler/health.rs @@ -1,29 +1,20 @@ use axum::extract::State; use axum::http::StatusCode; -use axum::Json; use axum::response::IntoResponse; -use serde::Serialize; use crate::server::AppState; use crate::service::KubernetesService; pub async fn health(State(app_state): State) -> impl IntoResponse { match app_state.kubernetes().healthy().await { - true => (StatusCode::OK, Json(HealthResponse { status: "ok".into() })), - false => (StatusCode::INTERNAL_SERVER_ERROR, Json(HealthResponse { status: "err".into() })), + true => StatusCode::OK, + false => StatusCode::INTERNAL_SERVER_ERROR, } } -#[derive(Serialize)] -struct HealthResponse { - status: String, -} - #[cfg(test)] mod tests { use axum::body::Body; use axum::http::{Request, StatusCode}; - use http_body_util::BodyExt; - use serde_json::{json, Value}; use tower::ServiceExt; use crate::config::Config; @@ -42,9 +33,6 @@ mod tests { .unwrap(); assert_eq!(response.status(), StatusCode::OK); - let body_bytes = response.into_body().collect().await.unwrap().to_bytes(); - let body: Value = serde_json::from_slice(&body_bytes).unwrap(); - assert_eq!(body, json!({"status": "ok"})); } #[tokio::test] @@ -61,8 +49,5 @@ mod tests { .unwrap(); assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR); - let body_bytes = response.into_body().collect().await.unwrap().to_bytes(); - let body: Value = serde_json::from_slice(&body_bytes).unwrap(); - assert_eq!(body, json!({"status": "err"})); } }