I just started learning Flask but I meet troubles with the POST method.
Here is my (very simple) Python code :
@app.route('/test')
def test(methods=["GET","POST"]):
if request.method=='GET':
return('<form action="/test" method="post"><input type="submit" value="Send" /></form>')
elif request.method=='POST':
return "OK this is a post method"
else:
return("ok")
when going to : http://127.0.0.1:5000/test
I successfully can submit my form by clicking on the send button but I a 405 error is returned :
Method Not Allowed The method is not allowed for the requested URL.
It is a pretty simple case, but I cannot understand where is my mistake.