MCPcopy
hub / github.com/AstrBotDevs/AstrBot / _json_or_empty

Function _json_or_empty

astrbot/dashboard/api/chat.py:42–47  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

40
41
42async def _json_or_empty(request: Request) -> dict[str, Any]:
43 try:
44 data = await request.json()
45 except Exception:
46 return {}
47 return data if isinstance(data, dict) else {}
48
49
50async def _json_or_none(request: Request) -> dict[str, Any] | None:

Calls 1

jsonMethod · 0.45

Tested by

no test coverage detected