From 0eaec19c479d8e3d948f39970f35ee0236089e3a Mon Sep 17 00:00:00 2001 From: mark neyer Date: Thu, 8 Nov 2012 20:16:24 -0800 Subject: [PATCH] now it actually gives you a response! --- server.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index 5371dbe..f1a403e 100644 --- a/server.py +++ b/server.py @@ -35,10 +35,12 @@ def __call__(self,environ,start_response): print '\noh snap, mismatch in two bodies!\n: %s?%s\n'% (path, query_string) all_bodies.append(this_response) - start_response('200 OK',[]) if all_bodies: - return all_bodies[-1] + status = '%s %s' % (req.response.status_code, req.response.reason) + start_response(status,req.response.headers.items()) + return this_body else: + start_response('200 OK',[]) return 'fudgesickles' def make_request(self, environ, for_server): @@ -46,14 +48,10 @@ def make_request(self, environ, for_server): method=environ['REQUEST_METHOD'], params=environ['QUERY_STRING']) - def main(): parser = argparse.ArgumentParser(description='compare multiple server\'s responses') - parser.add_argument('--hosts',action='append',dest='hosts') + parser.add_argument('--host',action='append',dest='hosts',help='include this host in the comparison') args = parser.parse_args() - - print 'now comparing hosts', args.hosts - WSGIServer(('127.0.0.1',8888),Handler(args.hosts)).serve_forever() if __name__ == "__main__" : main()