Correctly use options_response for OPTIONS requests (fixes #5)

master
Dustin C. Hatch 2012-11-30 13:13:17 -06:00
parent 0c7ebae8a9
commit 5cd113ee46
1 changed files with 4 additions and 3 deletions

View File

@ -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