werkzeug.exceptions.BadRequest: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. #2525
-
I tried the following code segment with flask
Using flask, I could host the
Even though I am not passing any body to this function, I am expecting the printing
Here are the package versions I am using
The above code worked perfectly when I downgraded the Werkzeug version to 2.0.0 But I must need to work on the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
How do you expect to get a JSON body when your request does not contain anything JSON-related? :) https://flask.palletsprojects.com/en/2.2.x/api/#flask.Request.get_json Try |
Beta Was this translation helpful? Give feedback.
-
@ThiefMaster Thank you. It worked |
Beta Was this translation helpful? Give feedback.
How do you expect to get a JSON body when your request does not contain anything JSON-related? :)
https://flask.palletsprojects.com/en/2.2.x/api/#flask.Request.get_json
Try
request.get_json(silent=True)
instead.