bravado-core icon indicating copy to clipboard operation
bravado-core copied to clipboard

Support requests in text/plain

Open aviskase opened this issue 6 years ago • 0 comments

Currently it isn't possible to send requests in text/plain format, because they are converted to application/json compatible format.

Temporary ugly monkeypatch snippet for those, who use bravado+pytest:

from bravado_core.param import marshal_param

def _marshal_param(param, value, request):
    marshal_param(param, value, request)
    if param.location == 'body' and param.op.consumes == ['text/plain']:
        request['headers']['Content-Type'] = 'text/plain'
        request['data'] = value

monkeypatch.setattr('bravado.client.marshal_param', _marshal_param)

aviskase avatar Jun 27 '18 13:06 aviskase