Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codec issues. #165

Open
techdragon opened this issue Oct 5, 2018 · 0 comments
Open

Codec issues. #165

techdragon opened this issue Oct 5, 2018 · 0 comments

Comments

@techdragon
Copy link

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'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant