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.
This commit is contained in:
parent
c755719d1e
commit
3ea4c3b60d
@ -12,4 +12,4 @@
|
||||
# under the License.
|
||||
"""See gabbi.driver and gabbbi.case."""
|
||||
|
||||
__version__ = '1.30.1'
|
||||
__version__ = '1.30.2'
|
||||
|
@ -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('')
|
||||
|
Loading…
Reference in New Issue
Block a user