Merge pull request #45 from mindflayer/master

Fix for string tokens
This commit is contained in:
Channel Cat 2016-10-16 14:23:29 -07:00 committed by GitHub
commit 73ef816d89
2 changed files with 6 additions and 1 deletions

View File

@ -26,7 +26,7 @@ class Router:
"""
routes = None
regex_types = {
"string": (None, "\w+"),
"string": (None, "[^/]+"),
"int": (int, "\d+"),
"number": (float, "[0-9\\.]+"),
"alpha": (None, "[A-Za-z]+"),

View File

@ -39,6 +39,11 @@ def test_dynamic_route_string():
assert response.text == 'OK'
assert results[0] == 'test123'
request, response = sanic_endpoint_test(app, uri='/folder/favicon.ico')
assert response.text == 'OK'
assert results[1] == 'favicon.ico'
def test_dynamic_route_int():
app = Sanic('test_dynamic_route_int')