Update app.py

use Python's build-in function `rstrip('/')` to remove the tail slash instead of judge if the tail char is slash and then remove it.
This commit is contained in:
kingname 2017-06-26 12:02:56 +08:00 committed by GitHub
parent dbcbf12456
commit 25553602a0

View File

@ -382,8 +382,8 @@ class Sanic:
'Endpoint with name `{}` was not found'.format( 'Endpoint with name `{}` was not found'.format(
view_name)) view_name))
if uri != '/' and uri.endswith('/'): if uri != '/':
uri = uri[:-1] uri = uri.rstrip('/')
out = uri out = uri