From: Janez Troha Date: Wed, 2 Dec 2015 11:22:57 +0000 (+0100) Subject: Handle empty body X-Git-Tag: v1.10.3~1^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=31b0e825b551d20855b76880426acf18fb7cb5d8;p=vcrpy.git Handle empty body --- diff --git a/vcr/matchers.py b/vcr/matchers.py index b54ed2f..8fe334e 100644 --- a/vcr/matchers.py +++ b/vcr/matchers.py @@ -49,7 +49,8 @@ def _transform_json(body): # 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 # 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')