mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 15:33:02 +00:00
Merge pull request #2609 from kinow/use-tornado-addslash
Replace existing redirect code by Tornado's addslash decorator
This commit is contained in:
@@ -26,6 +26,7 @@ from tornado.httputil import HTTPHeaders
|
|||||||
from tornado.httputil import url_concat
|
from tornado.httputil import url_concat
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
from tornado.log import app_log
|
from tornado.log import app_log
|
||||||
|
from tornado.web import addslash
|
||||||
from tornado.web import MissingArgumentError
|
from tornado.web import MissingArgumentError
|
||||||
from tornado.web import RequestHandler
|
from tornado.web import RequestHandler
|
||||||
|
|
||||||
@@ -1450,10 +1451,9 @@ class CSPReportHandler(BaseHandler):
|
|||||||
class AddSlashHandler(BaseHandler):
|
class AddSlashHandler(BaseHandler):
|
||||||
"""Handler for adding trailing slash to URLs that need them"""
|
"""Handler for adding trailing slash to URLs that need them"""
|
||||||
|
|
||||||
def get(self, *args):
|
@addslash
|
||||||
src = urlparse(self.request.uri)
|
def get(self):
|
||||||
dest = src._replace(path=src.path + '/')
|
pass
|
||||||
self.redirect(urlunparse(dest))
|
|
||||||
|
|
||||||
|
|
||||||
default_handlers = [
|
default_handlers = [
|
||||||
|
Reference in New Issue
Block a user