1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-10 17:45:35 +00:00

dont try to load chunked responses from cassettes, we already unchunked everything

This commit is contained in:
Kevin McCarthy
2015-05-05 21:32:32 -10:00
parent 856c38479a
commit 5b9b6cd8b5

View File

@@ -76,6 +76,13 @@ class VCRHTTPResponse(HTTPResponse):
self._closed = False self._closed = False
headers = self.recorded_response['headers'] 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.headers = self.msg = parse_headers(headers)
self.length = compat.get_header(self.msg, 'content-length') or None self.length = compat.get_header(self.msg, 'content-length') or None