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

lets try response headers as dicts

This commit is contained in:
Kevin McCarthy
2014-05-03 18:35:24 -10:00
parent f479f205ad
commit 1f99ede46f
2 changed files with 18 additions and 21 deletions

View File

@@ -15,7 +15,7 @@ def convert_to_unicode(resp):
def convert_headers_to_bytes(resp):
try:
resp['headers'] = [h.encode('utf-8') for h in resp['headers']]
resp['headers'] = dict([(k.encode('utf-8'), [v.encode('utf-8') for v in values]) for k, values in resp['headers'].items()])
except (KeyError, TypeError):
pass
return resp
@@ -23,7 +23,7 @@ def convert_headers_to_bytes(resp):
def convert_headers_to_unicode(resp):
try:
resp['headers'] = [h.decode('utf-8') for h in resp['headers']]
resp['headers'] = dict([(k.decode('utf-8'), [v.decode('utf-8') for v in values]) for k, values in resp['headers'].items()])
except (KeyError, TypeError):
pass
return resp