We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e60987 commit aa978ecCopy full SHA for aa978ec
src/notify_admin/__init__.py
@@ -1,4 +1,4 @@
1
-from fastapi import Request, APIRouter
+from fastapi import Request, APIRouter, HTTPException
2
from aiohttp import ClientSession
3
from loguru import logger
4
@@ -8,7 +8,12 @@
8
9
@router.post("/notify_admin")
10
async def notify_admin(request: Request):
11
- body = await request.json()
+ try:
12
+ body = await request.json()
13
+ except Exception as e:
14
+ logger.error(f"notify_admin invalid json: {e}")
15
+ raise HTTPException(status_code=400, detail="Invalid JSON")
16
+
17
logger.info(str(body))
18
19
if not settings.notify_admin_url:
0 commit comments