From acf0a7ec4aff18f1bfeb2b2a176d23cf73226458 Mon Sep 17 00:00:00 2001 From: kev Date: Sat, 16 Dec 2023 13:29:48 +0800 Subject: [PATCH] patch(webhook): mod default response msg --- src/api/v1/endpoint/webhook.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/api/v1/endpoint/webhook.py b/src/api/v1/endpoint/webhook.py index 1bb91c9..7ca0299 100644 --- a/src/api/v1/endpoint/webhook.py +++ b/src/api/v1/endpoint/webhook.py @@ -1,7 +1,6 @@ -import json import os from httpx import AsyncClient, HTTPError -from fastapi import APIRouter, Request, status +from fastapi import APIRouter, status from fastapi.responses import JSONResponse from fastapi.encoders import jsonable_encoder @@ -14,14 +13,17 @@ async def forward(url): @router.post("/webhook") -async def webhook(request: Request): +async def webhook(): try: - serialized_json = json.dumps(await request.json()) res = await forward(os.getenv("RELAY_SERVICE_ENDPOINT", "")) if res.status_code == status.HTTP_200_OK: return JSONResponse( - content=jsonable_encoder(json.loads(serialized_json)), + content=jsonable_encoder( + { + "message": "forwarded payload message to relay service successfully!" + } + ), status_code=status.HTTP_200_OK, ) else: