1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

python3 uses capital headers sometimes, let's do a case-agnostic header removal

This commit is contained in:
Kevin McCarthy
2015-05-05 21:59:48 -10:00
parent dc8eedf555
commit 4ade547779

View File

@@ -81,8 +81,9 @@ class VCRHTTPResponse(HTTPResponse):
# 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']
te_key = [h for h in headers.keys() if h.upper() == 'TRANSFER-ENCODING']
if te_key:
del headers[te_key[0]]
self.headers = self.msg = parse_headers(headers)
self.length = compat.get_header(self.msg, 'content-length') or None