check if method is added in strict slash logic

This commit is contained in:
Raphael Deem
2017-11-03 18:30:01 -07:00
parent 01042c1d98
commit bb8e9c6438
2 changed files with 28 additions and 2 deletions

View File

@@ -130,8 +130,15 @@ class Router:
return
# Add versions with and without trailing /
slashed_methods = self.routes_all.get(uri + '/', frozenset({}))
if isinstance(methods, Iterable):
_slash_is_missing = all(method in slashed_methods for
method in methods)
else:
_slash_is_missing = methods in slashed_methods
slash_is_missing = (
not uri[-1] == '/' and not self.routes_all.get(uri + '/', False)
not uri[-1] == '/' and not _slash_is_missing
)
without_slash_is_missing = (
uri[-1] == '/' and not