-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
- swagger-ui version: 2.1.4
- a swagger file reproducing the issue: I don't think this is specific to a swagger file, but I can create one if necessary.
I'm working with an API that requires versioning in the Accept header. The required Accept header value is in the format application/json; version=1.
The curl examples produced by swagger-ui don't include these, just --header 'Accept: application/json', without the version parameter. I found that this header does not come from the swagger file, but from the Content-Type header received from the server.
After confirming that the server was responding with application/json; version=1 I looked more deeply and found that swagger-ui strips the first semi-colon and everything after it.
// if server is nice, and sends content-type back, we can use it
if (headers) {
contentType = headers['Content-Type'] || headers['content-type'];
if (contentType) {
contentType = contentType.split(';')[0].trim();
}
}My question is whether this is desired behavior and whether it would be possible to at least make this stripping optional so that the curl command will be properly generated for APIs like this that require the Accept header param.
Thanks in advance.