#1248 Fixed display of date time format in response headers

This commit is contained in:
Anna Bodnia
2016-01-21 11:58:55 +02:00
parent 4600a53cd0
commit ba9a4237d5
3 changed files with 48 additions and 2 deletions

View File

@@ -246,6 +246,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
statusCode = ref5[q];
statusCode.isXML = isXML;
statusCode.isJSON = isJSON;
if (!_.isUndefined(statusCode.headers)) {
statusCode.headers = this.parseHeadersType(statusCode.headers);
}
this.addStatusCode(statusCode);
}
@@ -253,6 +256,26 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
return this;
},
parseHeadersType: function (headers) {
var map = {
'string': {
'date-time': 'dateTime',
'date' : 'date'
}
};
_.forEach(headers, function (header) {
var value;
header = header || {};
value = map[header.type] && map[header.type][header.format];
if (!_.isUndefined(value)) {
header.type = value;
}
});
return headers;
},
contains: function (produces, type) {
return produces.filter(function (val) {
if (val.indexOf(type) > -1) {