From eb0928f778aa373682791b423fb9831a8185f37a Mon Sep 17 00:00:00 2001 From: Janez Troha Date: Wed, 2 Dec 2015 12:22:57 +0100 Subject: [PATCH] Handle empty body --- vcr/matchers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcr/matchers.py b/vcr/matchers.py index 57e7a02d..73492924 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')