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

swagger client should not be modified by a service call. #160

Open
podarsmarty opened this issue Jul 14, 2015 · 2 comments
Open

swagger client should not be modified by a service call. #160

podarsmarty opened this issue Jul 14, 2015 · 2 comments

Comments

@podarsmarty
Copy link

For swaggerpy version 0.7.6 when we call and endpoint with a body parameter the header {'content-type': 'application/json'} is added for us. However, it is persisted which causes endpoints that don't need that header to fail.

i.e. -
client.get_client(...).endpoints.endpoint(body={'some_data': 'some_data'})

workaround for now is

client.get_client(...).endpoints.endpoint(_request_options={'headers': {'content-type': 'application/json'}}, body={'some_data': 'some_data'})

@prat0318
Copy link
Contributor

So this issue is that here we are fetching the _request_options reference and mutating it later. The dict provided by user should not get mutated at any cost. So, i think the fix should be:

_request_options = kwargs.pop('_request_options', {}).copy() or {}

which will needed to be patched to both swaggerpy and bravado.

@lucafavatella
Copy link

Do I understand correctly this was fixed by #166?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants