@@ -139,7 +139,7 @@ | |||||
url: this.url, | url: this.url, | ||||
method: "get", | method: "get", | ||||
headers: { | headers: { | ||||
accept: "application/json,application/json;charset=\"utf-8\",*/*" | |||||
accept: "application/json,application/json;charset=utf-8,*/*" | |||||
}, | }, | ||||
on: { | on: { | ||||
error: function (response) { | error: function (response) { | ||||
@@ -373,7 +373,7 @@ | |||||
method: "get", | method: "get", | ||||
useJQuery: this.useJQuery, | useJQuery: this.useJQuery, | ||||
headers: { | headers: { | ||||
accept: "application/json,application/json;charset=\"utf-8\",*/*" | |||||
accept: "application/json,application/json;charset=utf-8,*/*" | |||||
}, | }, | ||||
on: { | on: { | ||||
response: function (resp) { | response: function (resp) { | ||||
@@ -1503,7 +1503,13 @@ | |||||
if (contentType != null) { | if (contentType != null) { | ||||
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | ||||
if (response.content.data && response.content.data !== "") | if (response.content.data && response.content.data !== "") | ||||
out.obj = JSON.parse(response.content.data); | |||||
try { | |||||
out.obj = JSON.parse(response.content.data); | |||||
} | |||||
catch () { | |||||
// do not set out.obj | |||||
log ("unable to parse JSON content"); | |||||
} | |||||
else | else | ||||
out.obj = {} | out.obj = {} | ||||
} | } | ||||
@@ -1386,6 +1386,18 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; | |||||
return this.api.build(); | return this.api.build(); | ||||
}; | }; | ||||
SwaggerUi.prototype.collapseAll = function() { | |||||
return Docs.collapseEndpointListForResource(''); | |||||
}; | |||||
SwaggerUi.prototype.listAll = function() { | |||||
return Docs.collapseOperationsForResource(''); | |||||
}; | |||||
SwaggerUi.prototype.expandAll = function() { | |||||
return Docs.expandOperationsForResource(''); | |||||
}; | |||||
SwaggerUi.prototype.render = function() { | SwaggerUi.prototype.render = function() { | ||||
var _this = this; | var _this = this; | ||||
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...'); | this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...'); | ||||
@@ -1397,10 +1409,10 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; | |||||
this.showMessage(); | this.showMessage(); | ||||
switch (this.options.docExpansion) { | switch (this.options.docExpansion) { | ||||
case "full": | case "full": | ||||
Docs.expandOperationsForResource(''); | |||||
this.expandAll(); | |||||
break; | break; | ||||
case "list": | case "list": | ||||
Docs.collapseOperationsForResource(''); | |||||
this.listAll(); | |||||
} | } | ||||
if (this.options.onComplete) { | if (this.options.onComplete) { | ||||
this.options.onComplete(this.api, this); | this.options.onComplete(this.api, this); | ||||
@@ -139,7 +139,7 @@ | |||||
url: this.url, | url: this.url, | ||||
method: "get", | method: "get", | ||||
headers: { | headers: { | ||||
accept: "application/json,application/json;charset=\"utf-8\",*/*" | |||||
accept: "application/json,application/json;charset=utf-8,*/*" | |||||
}, | }, | ||||
on: { | on: { | ||||
error: function (response) { | error: function (response) { | ||||
@@ -373,7 +373,7 @@ | |||||
method: "get", | method: "get", | ||||
useJQuery: this.useJQuery, | useJQuery: this.useJQuery, | ||||
headers: { | headers: { | ||||
accept: "application/json,application/json;charset=\"utf-8\",*/*" | |||||
accept: "application/json,application/json;charset=utf-8,*/*" | |||||
}, | }, | ||||
on: { | on: { | ||||
response: function (resp) { | response: function (resp) { | ||||
@@ -1503,7 +1503,13 @@ | |||||
if (contentType != null) { | if (contentType != null) { | ||||
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | ||||
if (response.content.data && response.content.data !== "") | if (response.content.data && response.content.data !== "") | ||||
out.obj = JSON.parse(response.content.data); | |||||
try { | |||||
out.obj = JSON.parse(response.content.data); | |||||
} | |||||
catch () { | |||||
// do not set out.obj | |||||
log ("unable to parse JSON content"); | |||||
} | |||||
else | else | ||||
out.obj = {} | out.obj = {} | ||||
} | } | ||||