Skip to content

Commit

Permalink
fix(core): asgi error message due to missing body (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archento authored Aug 28, 2024
1 parent cef1201 commit 3a76aa0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions python/src/uagents/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ async def _asgi_send(
header = (
[[k.encode(), v.encode()] for k, v in headers.items()] if headers else None
)
if body is None:
body = {}

await send(
{
Expand All @@ -143,10 +145,7 @@ async def _asgi_send(
"headers": header or [[b"content-type", b"application/json"]],
}
)
if body:
await send(
{"type": "http.response.body", "body": json.dumps(body).encode()}
)
await send({"type": "http.response.body", "body": json.dumps(body).encode()})

async def handle_readiness_probe(self, headers: CaseInsensitiveDict, send):
"""
Expand Down

0 comments on commit 3a76aa0

Please sign in to comment.