cdent / gabbi

Declarative HTTP Testing for Python and anything else
http://gabbi.readthedocs.org/
Other
148 stars 34 forks source link

Verbose post bug #183

Closed tomviner closed 7 years ago

tomviner commented 7 years ago

VerboseHttp is printing the request and response via utils.decode_response_content.

decode_response_content expects its input to require decoding, if the content_type is non-binary. However the POST body data is already decoded into a string, so decoding again fails.

E POST data with verbose true

ERROR: POST data with verbose true
    Traceback (most recent call last):
      File "/home/tom/dev/gabbi/gabbi/case.py", line 92, in wrapper
        func(self)
      File "/home/tom/dev/gabbi/gabbi/case.py", line 140, in test_request
        self._run_test()
      File "/home/tom/dev/gabbi/gabbi/case.py", line 391, in _run_test
        redirect=test['redirects'])
      File "/home/tom/dev/gabbi/gabbi/case.py", line 322, in _run_request
        redirect=redirect
      File "/home/tom/dev/gabbi/gabbi/httpclient.py", line 113, in request
        self._print_body(headers, body)
      File "/home/tom/dev/gabbi/gabbi/httpclient.py", line 145, in _print_body
        utils.decode_response_content(headers, content))
      File "/home/tom/dev/gabbi/gabbi/utils.py", line 67, in decode_response_content
        return content.decode(charset)
    AttributeError: 'str' object has no attribute 'decode'
----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
cdent commented 7 years ago

Thanks. I suspect this once worked properly and then stopped in the switch from response-handlers to content-handlers (which moved around some string related stuff).

cdent commented 7 years ago

This will be in 1.27.1 which will be out in a few minutes.

tomviner commented 7 years ago

Confirmed. Installed from PyPI. Thanks for being so responsive! :+1: