make use of raw text

This commit is contained in:
Ludwig Lehnert 2025-02-14 21:12:35 +01:00
parent 07026dfc37
commit 99c32e6561

View File

@ -11,9 +11,10 @@ def read_root():
@app.post("/") @app.post("/")
async def receive_data(request: Request): async def receive_data(request: Request):
data = await request.json() data = await request.body()
print(data) str_data = data.decode('utf-8')
return {"received_data": data} print(str_data)
return {"received_data": str_data}
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000) uvicorn.run(app, host="0.0.0.0", port=8000)