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

Handle empty body

This commit is contained in:
Janez Troha
2015-12-02 12:22:57 +01:00
committed by Kevin McCarthy
parent ecbc192fc4
commit 31b0e825b5

View File

@@ -49,7 +49,8 @@ def _transform_json(body):
# Request body is always a byte string, but json.loads() wants a text # Request body is always a byte string, but json.loads() wants a text
# string. RFC 7159 says the default encoding is UTF-8 (although UTF-16 # string. RFC 7159 says the default encoding is UTF-8 (although UTF-16
# and UTF-32 are also allowed: hmmmmm). # and UTF-32 are also allowed: hmmmmm).
return json.loads(body.decode('utf-8')) if body:
return json.loads(body.decode('utf-8'))
_xml_header_checker = _header_checker('text/xml') _xml_header_checker = _header_checker('text/xml')