aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-22 13:06:47 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-22 13:06:47 +0800
commitcab5aab88515c15cae3d2ed8b268f7dd37d21f87 (patch)
tree5c09871ee96fe48ab3d8fc39c099b3b5a09d68f0 /fg21sim
parent53fb84ea01cc0de4f50806cd252273f435b41442 (diff)
downloadfg21sim-cab5aab88515c15cae3d2ed8b268f7dd37d21f87.tar.bz2
webui: Add "/debug" handler when in debug mode.
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/webui/app.py3
-rw-r--r--fg21sim/webui/handlers/base.py7
2 files changed, 10 insertions, 0 deletions
diff --git a/fg21sim/webui/app.py b/fg21sim/webui/app.py
index e234263..ba27222 100644
--- a/fg21sim/webui/app.py
+++ b/fg21sim/webui/app.py
@@ -67,6 +67,9 @@ class Application(tornado.web.Application):
url(r"/ajax/console", ConsoleAJAXHandler),
url(r"/ws", WSHandler),
]
+ if options.debug:
+ from .handlers.base import BaseRequestHandler
+ handlers.append(url(r"/debug", BaseRequestHandler, name="debug"))
# Application settings
settings = {
# The static files will be served from the default "/static/" URI.
diff --git a/fg21sim/webui/handlers/base.py b/fg21sim/webui/handlers/base.py
index 868ae48..0f93415 100644
--- a/fg21sim/webui/handlers/base.py
+++ b/fg21sim/webui/handlers/base.py
@@ -14,6 +14,13 @@ class BaseRequestHandler(tornado.web.RequestHandler):
"""
Base web request handler with user authentication support.
"""
+ def get(self):
+ """
+ Show the original HTTP request. DEBUG use.
+
+ Credit: https://stackoverflow.com/a/3111656/4856091
+ """
+ self.write(repr(self.request))
def get_current_user(self):
"""