E235
E235

Reputation: 13400

POST request is not being directed to POST route in Flask

I am developing a web app with Flask.
I have two routes:

@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"

When I access it with GET, I received "GET" but when I tried with POST request, it failed:

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

What can be a reason for that?

Upvotes: 0

Views: 40

Answers (1)

zoola969
zoola969

Reputation: 477

-x is a proxy arg. You should use -X in uppercase

Upvotes: 1

Related Questions