diff --git a/CHANGES b/CHANGES index b9aa3739..03611cc8 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,10 @@ Version 0.7 Release date to be announced, codename to be selected +- Added :meth:`~flask.Flask.make_default_options_response` + which can be used by subclasses to alter the default + behaviour for `OPTIONS` responses. + Version 0.6.1 ------------- diff --git a/flask/app.py b/flask/app.py index 72ed6292..faa5b168 100644 --- a/flask/app.py +++ b/flask/app.py @@ -690,13 +690,19 @@ class Flask(_PackageBoundObject): # if we provide automatic options for this URL and the # request came with the OPTIONS method, reply automatically if rule.provide_automatic_options and req.method == 'OPTIONS': - return self._make_default_options_response() + return self.make_default_options_response() # otherwise dispatch to the handler for that endpoint return self.view_functions[rule.endpoint](**req.view_args) except HTTPException, e: return self.handle_http_exception(e) - def _make_default_options_response(self): + def make_default_options_response(self): + """This method is called to create the default `OPTIONS` response. + This can be changed through subclassing to change the default + behaviour of `OPTIONS` responses. + + .. versionadded:: 0.7 + """ # This would be nicer in Werkzeug 0.7, which however currently # is not released. Werkzeug 0.7 provides a method called # allowed_methods() that returns all methods that are valid for