Codec issues.
techdragon opened this issue · 0 comments
techdragon commented
There appears to be an issue when the library tries to handle a blank API response in an application/json
based API when the response is "whitespace only", that is to say its empty, but not really empty, and the library appears to be trying to fall back and work out if it can parse it as XML when that has not been specified as a valid MIME type. The Swagger API Spec for this application says it consumes and produces application/json
on all of the endpoints, yet the library is trying to get a text/xml
codec?
Traceback (most recent call last):
...
File "/venv/lib/python3.6/site-packages/pyswagger/contrib/client/requests.py", line 74, in request
raw=six.BytesIO(rs.content).getvalue()
File "/venv/lib/python3.6/site-packages/pyswagger/io.py", line 416, in apply_with
data = self.__op._mime_codec.unmarshal(content_type, self.raw, _type=_type, _format=_format, name=name)
File "/venv/lib/python3.6/site-packages/pyswagger/primitives/codec.py", line 34, in unmarshal
raise Exception('Could not find codec for %s, data: %s, args: %s' % (mime, data, kwargs))
Exception: Could not find codec for text/xml, data: b' ', args: {'_type': 'object', '_format': None, 'name': 'ErrorResponse'}