diff --git a/src/flask/app.py b/src/flask/app.py index e596fe57..21fd2b6d 100644 --- a/src/flask/app.py +++ b/src/flask/app.py @@ -23,7 +23,6 @@ from werkzeug.exceptions import BadRequestKeyError from werkzeug.exceptions import default_exceptions from werkzeug.exceptions import HTTPException from werkzeug.exceptions import InternalServerError -from werkzeug.exceptions import MethodNotAllowed from werkzeug.routing import BuildError from werkzeug.routing import Map from werkzeug.routing import RequestRedirect @@ -2000,17 +1999,7 @@ class Flask(_PackageBoundObject): .. versionadded:: 0.7 """ adapter = _request_ctx_stack.top.url_adapter - if hasattr(adapter, "allowed_methods"): - methods = adapter.allowed_methods() - else: - # fallback for Werkzeug < 0.7 - methods = [] - try: - adapter.match(method="--") - except MethodNotAllowed as e: - methods = e.valid_methods - except HTTPException: - pass + methods = adapter.allowed_methods() rv = self.response_class() rv.allow.update(methods) return rv