Allow header to be specified for fetching swagger description
Currently the swagger-js module assumes application/json is the correct way to get the swagger resource declaration and api description. Need to allow passing options such as:
*/*
application/json;charset=utf8;
etc. Make it a configuration when initializing the client
will this be per swagger url?
I envision this would be part of the initialization of swagger-js (and therefore swagger-ui). Something like this (see defaultContentType below):
$(function () {
window.swaggerUi = new SwaggerUi({
url: "http://petstore.swagger.wordnik.com/api/api-docs",
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
defaultContentType: '*/*',
onComplete: function(swaggerApi, swaggerUi){
log("Loaded SwaggerUI");
}
$('pre code').each(function(i, e) {
hljs.highlightBlock(e)
});
},
onFailure: function(data) {
log("Unable to Load SwaggerUI");
},
docExpansion: "none",
sorter : "alpha"
});
I wonder if swagger-ui should be more forgiving.. ie, it should accept "*/json" by default. So there won't be a need to make this part of the initialization.
This was resolved in 2.0.39, released a few days ago.