route logic for trailing slash

This commit is contained in:
Raphael Deem
2017-02-20 15:58:27 -08:00
parent ff5d4276bc
commit 207ec1e032
3 changed files with 30 additions and 1 deletions

View File

@@ -22,6 +22,19 @@ def test_shorthand_routes_get():
request, response = app.test_client.post('/get')
assert response.status == 405
def test_route_optional_slash():
app = Sanic('test_route_optional_slash')
@app.get('/get')
def handler(request):
return text('OK')
request, response = app.test_client.get('/get')
assert response.text == 'OK'
request, response = app.test_client.get('/get/')
assert response.text == 'OK'
def test_shorthand_routes_post():
app = Sanic('test_shorhand_routes_post')