diff --git a/web.py b/web.py index c9c15db..56b4859 100644 --- a/web.py +++ b/web.py @@ -3,7 +3,7 @@ from a2wsgi import WSGIMiddleware from dotenv import load_dotenv -from flask import send_file +from flask import request, send_file from logics.auth_middleware import require_authentication from logics.webserver import create_app @@ -14,6 +14,14 @@ asgi_app = WSGIMiddleware(app) +@app.before_request +def method_override(): + if request.method == 'POST' and '_method' in request.form: + method = request.form['_method'].upper() + if method in ['PUT', 'DELETE', 'PATCH']: + request.environ['REQUEST_METHOD'] = method + + @app.get('/favicon.ico') def get_favicon(): # 1x1 transparent gif