fix: /api/v1/health returned 500 on every call

It passed a pydantic model straight to JSONResponse, which cannot render
it. Dump the model first.
This commit is contained in:
Felipe Novaes F Rocha 2026-06-12 16:23:04 -03:00
parent 4ec899ec6d
commit 7e163f880f

View File

@ -12,7 +12,8 @@ from node.api.serializers.health import HealthSerializer
async def get(request: NBERequest) -> Response:
response = await request.app.state.node_api.get_health()
return JSONResponse(response)
# JSONResponse can't render a pydantic model directly; dump it first.
return JSONResponse(response.model_dump(mode="json"))
async def _create_health_stream(node_api: NodeApi, *, poll_interval_seconds: int = 10) -> AsyncIterator[Health]: