我正在用Flask开发一个web应用程序
我有两条路线:
@app.route("/<random_id>", methods = ['GET'])
def random_url(random_id):
return "GET"
@app.route("/<random_id>", methods = ['POST'])
def random_url_post(random_id):
return "POST"
当我用GET访问它时;获取";但当我尝试POST请求时,它失败了:
root@ubuntu:~# curl http://localhost:1337/a
GET
root@ubuntu:~# curl -xPOST http://localhost:1337/a
curl: (5) Could not resolve proxy: POST
curl: (5) Could not resolve proxy: POST
这是什么原因?
-x
是一个代理参数。您应该在大写中使用-X