1
我有以下的燒瓶路線:瓶發帖JSON
@app.route('/change_groups', methods = ['POST'])
def change_groups():
if not request.json:
return "Not a json post"
return "json post!"
當我嫋嫋喜歡我回去"Not a json post"
預期:
curl --data "param1=value1¶m2=value2" localhost:8000/change_groups
然後我嘗試發佈JSON觸發"json post!"
代碼:
curl -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:8000/change_groups
第二次請求也觸發"Not a json post"
當我被帶到cting "json post!"
。
我該如何similate張貼JSON到這個燒瓶路線?