diff --git a/test/test.py b/test/test.py index 4801c4b38..a6b01ec3d 100644 --- a/test/test.py +++ b/test/test.py @@ -103,6 +103,33 @@ class PDFTestHandler(BaseHTTPRequestHandler): with open(path, "rb") as f: self.wfile.write(f.read()) + def sendIndex(self, path, query): + if not path.endswith("/"): + # we need trailing slash + self.send_response(301) + redirectLocation = path + "/" + if query: + redirectLocation += "?" + query + self.send_header("Location", redirectLocation) + self.end_headers() + return + + self.send_response(200) + self.send_header("Content-Type", "text/html") + self.end_headers() + if query == "frame": + self.wfile.write("
") + return + + location = os.path.abspath(os.path.realpath(DOC_ROOT + os.sep + path)) + self.wfile.write("