From: Kevin McCarthy Date: Wed, 6 May 2015 07:32:32 +0000 (-1000) Subject: dont try to load chunked responses from cassettes, we already unchunked everything X-Git-Tag: v1.4.2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=5b9b6cd8b5d70262a82f4f6c600a7bb677c71f74;p=vcrpy.git dont try to load chunked responses from cassettes, we already unchunked everything --- diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py index e45e658..c094e56 100644 --- a/vcr/stubs/__init__.py +++ b/vcr/stubs/__init__.py @@ -76,6 +76,13 @@ class VCRHTTPResponse(HTTPResponse): self._closed = False headers = self.recorded_response['headers'] + # Since we are loading a response that has already been serialized, our + # response is no longer chunked. That means we don't want any + # libraries trying to process a chunked response. By removing the + # transfer-encoding: chunked header, this should cause the downstream + # libraries to process this as a non-chunked response. + if 'chunked' in headers.get('transfer-encoding', []): + del headers['transfer-encoding'] self.headers = self.msg = parse_headers(headers) self.length = compat.get_header(self.msg, 'content-length') or None