forked from orbit-oss/flask
Add additional information in the url_rule docs (#2467)
If a user is making use of the errorhandler(405) decorator, and they wish to include an Allow header (as per HTTP spec), they may be confused to find that url_rule is None. This doc change aims to clarify that because the request was never successfully matched, it was never bound to a URL rule and to access the valid methods, they must examine routing_exception.
This commit is contained in:
parent
7e4e6eced3
commit
0a1090890f
1 changed files with 4 additions and 0 deletions
|
|
@ -119,6 +119,10 @@ class Request(RequestBase, JSONMixin):
|
|||
#: The internal URL rule that matched the request. This can be
|
||||
#: useful to inspect which methods are allowed for the URL from
|
||||
#: a before/after handler (``request.url_rule.methods``) etc.
|
||||
#: Though if the request's method was invalid for the URL rule,
|
||||
#: the valid list is available in ``routing_exception.valid_methods``
|
||||
#: instead (an attribute of the Werkzeug exception :exc:`~werkzeug.exceptions.MethodNotAllowed`)
|
||||
#: because the request was never internally bound.
|
||||
#:
|
||||
#: .. versionadded:: 0.6
|
||||
url_rule = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue