feat(add health endpoint):

This commit is contained in:
Alexander Myasoedov
2025-01-24 13:05:37 +02:00
parent e1400b6f58
commit d285ef645c
2 changed files with 19 additions and 0 deletions
+7
View File
@@ -1,6 +1,7 @@
import random import random
from fastapi import APIRouter, File, Header, HTTPException, UploadFile from fastapi import APIRouter, File, Header, HTTPException, UploadFile
from fastapi.responses import JSONResponse
from ..models.schemas import FileProbeResponse, Probe from ..models.schemas import FileProbeResponse, Probe
from ..probe_actor.refusal import REFUSAL_MARKS from ..probe_actor.refusal import REFUSAL_MARKS
@@ -70,3 +71,9 @@ async def self_probe_image():
@router.get("/v1/data-config") @router.get("/v1/data-config")
async def data_config(): async def data_config():
return [m for m in REGISTRY] return [m for m in REGISTRY]
@router.get("/health")
async def health_check():
"""Health check endpoint."""
return JSONResponse(content={"status": "ok"})
+12
View File
@@ -0,0 +1,12 @@
from fastapi.testclient import TestClient
from ..app import app
def test_health_check():
"""Test the health check endpoint."""
client = TestClient(app)
response = client.get("/health")
assert response.status_code == 200
assert response.json() == {"status": "ok"}