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

Update _remove_headers to work with headers copy

Because of the filter implementation here we nedd to work only
with clone of the headers and request. subj to refactor
This commit is contained in:
Max Shytikov
2014-04-30 04:06:14 +02:00
parent 3d2da26933
commit 62d19e5cc1

View File

@@ -3,10 +3,13 @@ import copy
def _remove_headers(request, headers_to_remove):
headers = copy.copy(request.headers)
headers_to_remove = [h.lower() for h in headers_to_remove]
keys = [k for k in request.headers if k.lower() in headers_to_remove]
for k in keys:
request.headers.pop(k)
keys = [k for k in headers if k.lower() in headers_to_remove]
if keys:
for k in keys:
headers.pop(k)
request.headers = headers
return request