grape-swagger icon indicating copy to clipboard operation
grape-swagger copied to clipboard

Default consumes setting for desc method

Open jeyraof opened this issue 7 years ago • 3 comments

My POST apis almost do with formData. Now, these methods have consumes setting manually:

desc 'method1', consumes: ['application/x-www-form-urlencoded']
params {}
post {}

desc 'method3', consumes: ['application/x-www-form-urlencoded']
params {}
post {}

...

Is the way to set default consumes to ['application/x-www-form-urlencoded'] ?

jeyraof avatar Jul 24 '17 13:07 jeyraof

I have to do the same thing when I try to integrate Swagger-ui into the project.

pdkproitf avatar Aug 16 '17 11:08 pdkproitf

Failed to find a way to make it global. Here is my walk around for anyone who is interested. Add this field to your SwaggerUIBundle parameter

requestInterceptor: function (request) {
    request.headers["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"
    return request
}

jackalcooper avatar Oct 24 '17 04:10 jackalcooper

Hey folks, I've created a PR that adds a global option at #872. Hope it gets reviewed/added soon.

spaceraccoon avatar Oct 07 '22 09:10 spaceraccoon