mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
VCR AttributeError: 'NoneType' object has no attribute 'encode'
Hi, Using an old fork but may be usefull. I think checking the string is required like on line 47. Best regards
This commit is contained in:
committed by
Kevin McCarthy
parent
ecbc192fc4
commit
9c275dd86a
@@ -24,7 +24,7 @@ def convert_body_to_bytes(resp):
|
|||||||
http://pyyaml.org/wiki/PyYAMLDocumentation#Python3support
|
http://pyyaml.org/wiki/PyYAMLDocumentation#Python3support
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if not isinstance(resp['body']['string'], six.binary_type):
|
if resp['body']['string'] is not None and not isinstance(resp['body']['string'], six.binary_type):
|
||||||
resp['body']['string'] = resp['body']['string'].encode('utf-8')
|
resp['body']['string'] = resp['body']['string'].encode('utf-8')
|
||||||
except (KeyError, TypeError, UnicodeEncodeError):
|
except (KeyError, TypeError, UnicodeEncodeError):
|
||||||
# The thing we were converting either wasn't a dictionary or didn't
|
# The thing we were converting either wasn't a dictionary or didn't
|
||||||
|
|||||||
Reference in New Issue
Block a user