diff --git a/src/milla/app.py b/src/milla/app.py index 05b371b..3469413 100644 --- a/src/milla/app.py +++ b/src/milla/app.py @@ -50,6 +50,9 @@ class BaseApplication(object): DEFAULT_CONFIG = {} + #: Enable HTTP method emulation for POST requests? + post_method_emulation = True + def __init__(self): self.config = self.DEFAULT_CONFIG.copy() self.setup_routes() @@ -163,8 +166,9 @@ class BaseApplication(object): # Sometimes, hacky applications will try to "emulate" some HTTP # methods like PUT or DELETE by specifying an _method parameter # in a POST request. - if request.method == 'POST' and '_method' in request.POST: - request.method = request.POST.pop('_method') + if self.post_method_emulation: + if request.method == 'POST' and '_method' in request.POST: + request.method = request.POST.pop('_method') return request def resolve_path(self, path_info):