mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-07-03 05:39:27 +00:00
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:
parent
4ec899ec6d
commit
7e163f880f
@ -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]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user