]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
python3 uses capital headers sometimes, let's do a case-agnostic header removal
authorKevin McCarthy <me@kevinmccarthy.org>
Wed, 6 May 2015 07:59:48 +0000 (21:59 -1000)
committerKevin McCarthy <me@kevinmccarthy.org>
Wed, 6 May 2015 07:59:48 +0000 (21:59 -1000)
vcr/stubs/__init__.py

index c094e569bb3151e73f0eb538c71404c82b13e814..4b1ca862012c4d94fece3390fa4dc9ff1ef54da8 100644 (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