mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
Add headers in proxy server response
This commit is contained in:
committed by
Samuel Fekete
parent
06dc2190d6
commit
4b6b5effc7
@@ -19,10 +19,15 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
'''
|
'''
|
||||||
Simple proxy server.
|
Simple proxy server.
|
||||||
|
|
||||||
(from: http://effbot.org/librarybook/simplehttpserver.htm).
|
(Inspired by: http://effbot.org/librarybook/simplehttpserver.htm).
|
||||||
'''
|
'''
|
||||||
def do_GET(self):
|
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')
|
@pytest.yield_fixture(scope='session')
|
||||||
|
|||||||
Reference in New Issue
Block a user