def get(self):
self.write("Hello world!")
+ class PathQuotingHandler(RequestHandler):
+ def get(self, path):
+ self.write(path)
+
# It would be better to run the wsgiref server implementation in
# another thread instead of using our own WSGIContainer, but this
# fits better in our async testing framework and the wsgiref
# validator should keep us honest
return WSGIContainer(validator(WSGIApplication([
- ("/", HelloHandler)])))
+ ("/", HelloHandler),
+ ("/path/(.*)", PathQuotingHandler),
+ ])))
def test_simple(self):
response = self.fetch("/")
self.assertEqual(response.body, b("Hello world!"))
+ def test_path_quoting(self):
+ response = self.fetch("/path/foo%20bar%C3%A9")
+ self.assertEqual(response.body, u"foo bar\u00e9".encode("utf-8"))
+
# This is kind of hacky, but run some of the HTTPServer tests through
# WSGIContainer and WSGIApplication to make sure everything survives
# repeated disassembly and reassembly.
environ = {
"REQUEST_METHOD": request.method,
"SCRIPT_NAME": "",
- "PATH_INFO": request.path,
+ "PATH_INFO": urllib.unquote(request.path),
"QUERY_STRING": request.query,
"REMOTE_ADDR": request.remote_ip,
"SERVER_NAME": host,