diff --git a/endpoints/yolo-post.post.py b/endpoints/yolo-post.post.py index a67395e..0695999 100644 --- a/endpoints/yolo-post.post.py +++ b/endpoints/yolo-post.post.py @@ -4,12 +4,18 @@ from core.database import fake_users_db router = APIRouter() @router.post("/yolo-post") -async def yolo_post_handler(sentence: str = Body(...)): - """Echo sentence backwards""" - reversed_sentence = sentence[::-1] +async def yolo_post_handler(payload: dict = Body(...)): + """Reverse input sentence""" + if "sentence" not in payload: + raise HTTPException(status_code=400, detail="Missing 'sentence' field in input") + + input_sentence = payload["sentence"] + reversed_sentence = input_sentence[::-1] return { "message": "Sentence reversed successfully", - "original_sentence": sentence, - "reversed_sentence": reversed_sentence + "data": { + "original": input_sentence, + "reversed": reversed_sentence + } } \ No newline at end of file