bravado
bravado copied to clipboard
swagger client should not be modified by a service call.
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'})
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
.
Do I understand correctly this was fixed by #166?