feat: unify card runtime and event-driven web ui
This commit is contained in:
parent
0edf8c3fef
commit
4dfb7ca3cc
105 changed files with 17382 additions and 8505 deletions
15
route_helpers.py
Normal file
15
route_helpers.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from fastapi import Request
|
||||
|
||||
|
||||
async def read_json_request(request: Request) -> dict:
|
||||
try:
|
||||
payload = await request.json()
|
||||
except (json.JSONDecodeError, UnicodeDecodeError) as exc:
|
||||
raise ValueError("request body must be valid JSON") from exc
|
||||
if not isinstance(payload, dict):
|
||||
raise ValueError("request body must be a JSON object")
|
||||
return payload
|
||||
Loading…
Add table
Add a link
Reference in a new issue