Skip to content

Commit

Permalink
now it actually gives you a response!
Browse files Browse the repository at this point in the history
  • Loading branch information
neyer committed Nov 9, 2012
1 parent e0f3aab commit 0eaec19
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,23 @@ 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):
return requests.Request(url=for_server+environ['PATH_INFO'],
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()

0 comments on commit 0eaec19

Please sign in to comment.