From 3ea4c3b60d86e7c4bb4c1d935279f498a4bce8fe Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Fri, 6 Jan 2017 19:18:31 +0000 Subject: [PATCH] Fix verbose printing of json bodies If a request is content-type application/json, but the body is empty, a request to verbosely print the body of the test will cause a JSONdecoder error. --- gabbi/__init__.py | 2 +- gabbi/httpclient.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gabbi/__init__.py b/gabbi/__init__.py index dd51488..49122f0 100644 --- a/gabbi/__init__.py +++ b/gabbi/__init__.py @@ -12,4 +12,4 @@ # under the License. """See gabbi.driver and gabbbi.case.""" -__version__ = '1.30.1' +__version__ = '1.30.2' diff --git a/gabbi/httpclient.py b/gabbi/httpclient.py index 88f873d..6310ef6 100644 --- a/gabbi/httpclient.py +++ b/gabbi/httpclient.py @@ -148,7 +148,7 @@ class VerboseHttp(Http): # handler's loads() and dumps(). Not doing that now # because it would be pointless (no other interesting # handlers) and this approach may be entirely wrong. - if jsonhandler.JSONHandler.accepts(content_type): + if content and jsonhandler.JSONHandler.accepts(content_type): data = jsonhandler.JSONHandler.loads(content) content = jsonhandler.JSONHandler.dumps(data, pretty=True) self._verbose_output('')