Open explody opened 6 years ago
unmarshal_response
takes care of converting the received response into a python object.
The method returns None
because the specs does not specify any content of the response, so from a spec prospective the response body "does not exists".
So a possible workaroud could be to manually extract the response body in case unmarshal_response is None
.
I immagine that you're ending up in that call due to bravado
, if so bravado
has a request option that allows you to receive the marshaled response and the raw response, here is the doc.
After a bit of digging, I found that a "None" response I was getting from an API was a result of this snippet in bravado_core/response.py:
The swagger json from this particular API declares return codes, but does not fully define the response spec:
Perhaps most importantly, IMHO:
validate_reponses: False
, enforcing a schema for the response serves no purpose since we don't need a schema if we're not validating the response content, ergo why would a defined schema be required?My suggested change would be simple - if validate_responses is False, simply ignore the response schema, whether it's there or not, and return the response as is currently done for non-JSON replies.
Thoughts?