hive-c0re: replace json! with typed structs in dashboard handlers
This commit is contained in:
parent
fbffccbbb2
commit
351341e87c
5 changed files with 86 additions and 37 deletions
|
|
@ -28,19 +28,20 @@ use utoipa::ToSchema;
|
|||
|
||||
use crate::host_stats::ServerWarning;
|
||||
|
||||
#[derive(Serialize, ToSchema)]
|
||||
struct LiveBody {
|
||||
status: &'static str,
|
||||
}
|
||||
|
||||
/// Liveness. Always `200`; no further checks.
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/health/live",
|
||||
responses((status = 200, description = "process is up", body = serde_json::Value)),
|
||||
responses((status = 200, description = "process is up", body = LiveBody)),
|
||||
tag = "health"
|
||||
)]
|
||||
pub(super) async fn get_health_live() -> Response {
|
||||
(
|
||||
StatusCode::OK,
|
||||
axum::Json(serde_json::json!({ "status": "ok" })),
|
||||
)
|
||||
.into_response()
|
||||
(StatusCode::OK, axum::Json(LiveBody { status: "ok" })).into_response()
|
||||
}
|
||||
|
||||
#[derive(Serialize, ToSchema)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue