From 8f26827a903dbdb62e4d3eb4544e4f27b18d4329 Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 3 Sep 2022 13:23:43 +0800 Subject: [PATCH] Add method for testing json --- main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 5e094a6..d244ebd 100644 --- a/main.py +++ b/main.py @@ -185,6 +185,15 @@ async def download_inp(name: str, response: Response): response.status_code = status.HTTP_400_BAD_REQUEST return True - +@app.get("/getjson/") +async def get_json(): + return JSONResponse( + status_code = status.HTTP_400_BAD_REQUEST, + content={ + 'code': 400, + 'message': "this is message", + 'data': 123, + } + )