Skip to content

Commit

Permalink
Fix verbose printing of json bodies
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cdent committed Jan 6, 2017
1 parent c755719 commit 3ea4c3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gabbi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# under the License.
"""See gabbi.driver and gabbbi.case."""

__version__ = '1.30.1'
__version__ = '1.30.2'
2 changes: 1 addition & 1 deletion gabbi/httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _print_body(self, headers, content):
# 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('')
Expand Down

0 comments on commit 3ea4c3b

Please sign in to comment.