Skip to content

Commit

Permalink
Merge pull request #183 from tomviner/verbose-post-bug
Browse files Browse the repository at this point in the history
Verbose post bug
  • Loading branch information
cdent committed Nov 4, 2016
2 parents 3909528 + 723d49f commit f30fe24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gabbi/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def _run_test(self):
raise exception.GabbiFormatError(
'malformed headers in test %s: %s' % (test['name'], exc))

if test['data'] is not '':
if test['data'] != '':
body = self._test_data_to_string(
test['data'],
utils.extract_content_type(headers, default='')[0])
Expand Down
9 changes: 9 additions & 0 deletions gabbi/tests/test_verbose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tests:

- name: POST data with verbose true
verbose: true
POST: /
request_headers:
content-type: application/json
data:
'text'
3 changes: 2 additions & 1 deletion gabbi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io
import os

import six
import yaml


Expand Down Expand Up @@ -62,7 +63,7 @@ def decode_response_content(header_dict, content):
"""Decode content to a proper string."""
content_type, charset = extract_content_type(header_dict)

if not_binary(content_type):
if not_binary(content_type) and isinstance(content, six.binary_type):
return content.decode(charset)
else:
return content
Expand Down

0 comments on commit f30fe24

Please sign in to comment.