From 4ade547779ff55a902f3774bd9f69e13c9607a34 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Tue, 5 May 2015 21:59:48 -1000 Subject: [PATCH] python3 uses capital headers sometimes, let's do a case-agnostic header removal --- vcr/stubs/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py index c094e56..4b1ca86 100644 --- a/vcr/stubs/__init__.py +++ b/vcr/stubs/__init__.py @@ -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