This is my code, a very simple program. Even though POST is present, server is showing 405 on POST request. I tried Postman, http-prompt but the result is same "405". On sending OPTIONS request to server, only GET, HEAD and OPTIONS are shown as allowed methods.Even POST request through a html form is showing 405, of course because server does not even have POST as allowed method despite POST being present in methods kwarg.
- I am on a Mac Machine(High Sierra)
- Tried using both gunicorn and inbuilt flask server.
- Tried using Postman, http-prompt
@app.route('/')
def index(methods=['GET', 'POST']):
if request.method == 'GET':
return render_template('index.html')
else:
return 'POST'
index.html is contains a simple HTML heading.