fix edge case with methods as None
This commit is contained in:
parent
2c3f50e34a
commit
52feff266e
|
@ -3,7 +3,7 @@ from collections import defaultdict, namedtuple
|
|||
from collections.abc import Iterable
|
||||
from functools import lru_cache
|
||||
|
||||
from sanic.exceptions import NotFound, InvalidUsage, MethodNotSupported
|
||||
from sanic.exceptions import NotFound, MethodNotSupported
|
||||
from sanic.views import CompositionView
|
||||
|
||||
Route = namedtuple(
|
||||
|
@ -359,7 +359,8 @@ class Router:
|
|||
:return: frozenset of supported methods
|
||||
"""
|
||||
route = self.routes_all.get(url)
|
||||
return getattr(route, 'methods', frozenset())
|
||||
# if methods are None then this logic will prevent an error
|
||||
return getattr(route, 'methods', None) or frozenset()
|
||||
|
||||
@lru_cache(maxsize=ROUTER_CACHE_SIZE)
|
||||
def _get(self, url, method, host):
|
||||
|
|
Loading…
Reference in New Issue
Block a user