I have the following flask route:
@app.route('/change_groups', methods = ['POST'])
def change_groups():
if not request.json:
return "Not a json post"
return "json post!"
When I curl like this I get back "Not a json post"
as expected:
curl --data "param1=value1¶m2=value2" localhost:8000/change_groups
I then try to post json to trigger the "json post!"
code:
curl -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:8000/change_groups
The second request also triggers "Not a json post"
when I was expecting "json post!"
.
How can I similate posting json to this Flask route?