Fix missing head request support

This commit is contained in:
sqozz 2018-06-09 21:49:44 +02:00
parent ef2046b610
commit 6b10ee6093

View file

@ -5,10 +5,11 @@ from urllib.parse import urlparse
app = Flask(__name__) app = Flask(__name__)
# HEAD is implicit with flask
@app.route('/', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST'])
@app.route('/<shortLink>', methods=['GET', 'POST']) @app.route('/<shortLink>', methods=['GET', 'POST'])
def short(shortLink=""): def short(shortLink=""):
if request.method == "GET": if request.method == "GET" or request.method == "HEAD":
if shortLink: if shortLink:
noauto = shortLink[-1] == "+" noauto = shortLink[-1] == "+"
if noauto: shortLink = shortLink[:-1] if noauto: shortLink = shortLink[:-1]