added type check
This commit is contained in:
189
dist/swagger-ui.js
vendored
189
dist/swagger-ui.js
vendored
File diff suppressed because one or more lines are too long
26
dist/swagger-ui.min.js
vendored
26
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -651,7 +651,6 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
|
|||||||
|
|
||||||
// puts the response data in UI
|
// puts the response data in UI
|
||||||
showStatus: function(response) {
|
showStatus: function(response) {
|
||||||
console.log(response.headers);
|
|
||||||
var url, content;
|
var url, content;
|
||||||
if (response.content === undefined) {
|
if (response.content === undefined) {
|
||||||
content = response.data;
|
content = response.data;
|
||||||
@@ -695,9 +694,17 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
|
|||||||
|
|
||||||
if ('Blob' in window) {
|
if ('Blob' in window) {
|
||||||
var type = contentType || 'text/html';
|
var type = contentType || 'text/html';
|
||||||
|
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
var href = window.URL.createObjectURL(content);
|
var href;
|
||||||
|
|
||||||
|
if({}.toString.apply(content) === '[object Blob]') {
|
||||||
|
href = window.URL.createObjectURL(content);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var binaryData = [];
|
||||||
|
binaryData.push(content);
|
||||||
|
href = window.URL.createObjectURL(new Blob(binaryData, {type: type}));
|
||||||
|
}
|
||||||
var fileName = response.url.substr(response.url.lastIndexOf('/') + 1);
|
var fileName = response.url.substr(response.url.lastIndexOf('/') + 1);
|
||||||
var download = [type, fileName, href].join(':');
|
var download = [type, fileName, href].join(':');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user