Add kwarg to disable auto OPTIONS on add_url_rule
Adds support for a kwarg `provide_automatic_options` on `add_url_rule`, which lets you turn off the automatic OPTIONS response on a per-URL basis even if your view functions are functions, not classes (so you can't provide attrs on them).
This commit is contained in:
parent
db09c6798e
commit
011b129b6b
2 changed files with 45 additions and 2 deletions
|
|
@ -1013,8 +1013,10 @@ class Flask(_PackageBoundObject):
|
|||
|
||||
# starting with Flask 0.8 the view_func object can disable and
|
||||
# force-enable the automatic options handling.
|
||||
provide_automatic_options = getattr(view_func,
|
||||
'provide_automatic_options', None)
|
||||
provide_automatic_options = options.pop(
|
||||
'provide_automatic_options', getattr(view_func,
|
||||
'provide_automatic_options', None))
|
||||
|
||||
|
||||
if provide_automatic_options is None:
|
||||
if 'OPTIONS' not in methods:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue