From: Samuel Fekete Date: Fri, 3 Nov 2017 11:07:23 +0000 (+0000) Subject: Add headers in proxy server response X-Git-Tag: v2.0.0~5^2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=4b6b5effc744583eb0227d14d0c5e324c50cf074;p=vcrpy.git Add headers in proxy server response --- diff --git a/tests/integration/test_proxy.py b/tests/integration/test_proxy.py index d3c8df1..a1fc003 100644 --- a/tests/integration/test_proxy.py +++ b/tests/integration/test_proxy.py @@ -19,10 +19,15 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): ''' Simple proxy server. - (from: http://effbot.org/librarybook/simplehttpserver.htm). + (Inspired by: http://effbot.org/librarybook/simplehttpserver.htm). ''' def do_GET(self): - self.copyfile(urlopen(self.path), self.wfile) + upstream_response = urlopen(self.path) + self.send_response(upstream_response.status, upstream_response.msg) + for header in upstream_response.headers.items(): + self.send_header(*header) + self.end_headers() + self.copyfile(upstream_response, self.wfile) @pytest.yield_fixture(scope='session')