Skip to content

Commit c067773

Browse files
Pandedepre-commit-ci[bot]
andauthoredMar 18, 2025
Add method GET on route /health (#886)
* add get method `/health` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 626df17 commit c067773

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed
 

‎tools/server/views.py

+18-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
import ormsgpack
88
import soundfile as sf
99
import torch
10-
from kui.asgi import Body, HTTPException, JSONResponse, Routes, StreamResponse, request
10+
from kui.asgi import (
11+
Body,
12+
HTTPException,
13+
HttpView,
14+
JSONResponse,
15+
Routes,
16+
StreamResponse,
17+
request,
18+
)
1119
from loguru import logger
1220
from typing_extensions import Annotated
1321

@@ -40,9 +48,15 @@
4048
routes = Routes()
4149

4250

43-
@routes.http.post("/v1/health")
44-
async def health():
45-
return JSONResponse({"status": "ok"})
51+
@routes.http("/v1/health")
52+
class Health(HttpView):
53+
@classmethod
54+
async def get(cls):
55+
return JSONResponse({"status": "ok"})
56+
57+
@classmethod
58+
async def post(cls):
59+
return JSONResponse({"status": "ok"})
4660

4761

4862
@routes.http.post("/v1/vqgan/encode")

0 commit comments

Comments
 (0)
Failed to load comments.