I think this must be a really simple question or perhaps I'm overlooking something major, but I'm only getting started and there is something I just can't figure out. I wrote a simple flask application:
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/")
def index():
return "Index!"
@app.route('/test', methods=['GET', 'POST'])
def test():
if request.method=='GET':
return "OK this is a get method"
elif request.method=='POST':
return "OK this is a post method"
else:
return("ok")
if __name__ == "__main__":
app.run()
When I open the following URL I get the GET method message as expected.
http://localhost:5000/test
But I can't switch it to a POST method. What URL would I need to enter to see the POST method message?