From de334905866806728a3730bb137f5fefb99f5db2 Mon Sep 17 00:00:00 2001 From: Christian Struck Date: Wed, 22 Oct 2014 16:05:06 -0700 Subject: [PATCH] [ADD] Added the feature to return 0 content to the python http test server and added functionality for post requests --- testing/scripts/httpd.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/testing/scripts/httpd.py b/testing/scripts/httpd.py index 0732614bc2..e00eb3a6bc 100755 --- a/testing/scripts/httpd.py +++ b/testing/scripts/httpd.py @@ -2,13 +2,26 @@ import BaseHTTPServer + class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header("Content-type", "text/plain") self.end_headers() - self.wfile.write("It works!") + if "/empty" in self.path: + self.wfile.write("") + else: + self.wfile.write("It works!") + + def do_POST(self): + self.send_response(200) + self.send_header("Content-type", "text/plain") + self.end_headers() + if "/empty" in self.path: + self.wfile.write("") + else: + self.wfile.write("It works!") def version_string(self): return "1.0"