From 5cd113ee46b7d729342debae9724010a50d4605b Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 30 Nov 2012 13:13:17 -0600 Subject: [PATCH] Correctly use options_response for OPTIONS requests (fixes #5) --- src/milla/app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/milla/app.py b/src/milla/app.py index d7117e1..740057f 100644 --- a/src/milla/app.py +++ b/src/milla/app.py @@ -48,7 +48,7 @@ class Application(object): configuration is copied and assigned to ``request.config``. ''' - DEFAULT_ALLOWED_METHODS = ['GET', 'HEAD', 'OPTIONS'] + DEFAULT_ALLOWED_METHODS = ['GET', 'HEAD'] def __init__(self, dispatcher): self.dispatcher = dispatcher @@ -84,8 +84,9 @@ class Application(object): response.headers = allow_header return response func = options_response - return HTTPMethodNotAllowed(headers=allow_header)(environ, - start_response) + else: + func = HTTPMethodNotAllowed(headers=allow_header) + return func(environ, start_response) start_response_wrapper = StartResponseWrapper(start_response) request.start_response = start_response_wrapper