gocardless / gocardless-pro-python

GoCardless Pro Python Client
MIT License
37 stars 26 forks source link

Fix: #63 malformed response when deleting a customer #81

Closed 1dimir closed 1 year ago

1dimir commented 1 year ago

According to documentation (https://developer.gocardless.com/api-reference#customers-remove-a-customer) HTTP 204 No Content - is a valid answer, that contains no payload.

api_client.py::_handle_errors() expects a jsonable body in response in any case. That goes wrong in case of HTTP DELETE.

These changes introduce an exception for HTTP 204 specifically.

Added two tests for both possible answers to deletion request: HTTP 204 No Content and HTTP 410 Gone.

tox.ini updated in order to rapidly validate a single test - arguments are passed to pytest.

hjheath commented 1 year ago

Thanks for raising this! Unfortunately this is an auto-generated repo so we can't accept pull requests. I've applied a very similar fix to the (private) template repo and this should be fixed in https://github.com/gocardless/gocardless-pro-python/releases/tag/v1.46.1