Correctly use options_response for OPTIONS requests (fixes #5)
parent
0c7ebae8a9
commit
5cd113ee46
|
@ -48,7 +48,7 @@ class Application(object):
|
||||||
configuration is copied and assigned to ``request.config``.
|
configuration is copied and assigned to ``request.config``.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
DEFAULT_ALLOWED_METHODS = ['GET', 'HEAD', 'OPTIONS']
|
DEFAULT_ALLOWED_METHODS = ['GET', 'HEAD']
|
||||||
|
|
||||||
def __init__(self, dispatcher):
|
def __init__(self, dispatcher):
|
||||||
self.dispatcher = dispatcher
|
self.dispatcher = dispatcher
|
||||||
|
@ -84,8 +84,9 @@ class Application(object):
|
||||||
response.headers = allow_header
|
response.headers = allow_header
|
||||||
return response
|
return response
|
||||||
func = options_response
|
func = options_response
|
||||||
return HTTPMethodNotAllowed(headers=allow_header)(environ,
|
else:
|
||||||
start_response)
|
func = HTTPMethodNotAllowed(headers=allow_header)
|
||||||
|
return func(environ, start_response)
|
||||||
|
|
||||||
start_response_wrapper = StartResponseWrapper(start_response)
|
start_response_wrapper = StartResponseWrapper(start_response)
|
||||||
request.start_response = start_response_wrapper
|
request.start_response = start_response_wrapper
|
||||||
|
|
Loading…
Reference in New Issue