Fix issue #1132 "JS error when testing uploadFile method (http://petstore.swagger.io/#!/pet/uploadFile)"

This commit is contained in:
Mohsen Azimi
2015-04-14 14:01:38 -07:00
parent e0687b044d
commit 53966f7aa8
3 changed files with 10 additions and 12 deletions

11
dist/swagger-ui.js vendored
View File

@@ -20692,7 +20692,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
} else { } else {
// Default validator // Default validator
this.model.validatorUrl = 'http://online.swagger.io/validator'; this.model.validatorUrl = window.location.protocol + '//online.swagger.io/validator';
} }
} }
}, },
@@ -21089,7 +21089,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// Note: This is compiled code // Note: This is compiled code
// TODO: Refactor // TODO: Refactor
handleFileUpload: function(map, form) { handleFileUpload: function(map, form) {
var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, obj, p, param, params, ref1, ref2, ref3, ref4; var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, p, param, params, ref1, ref2, ref3, ref4;
ref1 = form.serializeArray(); ref1 = form.serializeArray();
for (l = 0, len = ref1.length; l < len; l++) { for (l = 0, len = ref1.length; l < len; l++) {
o = ref1[l]; o = ref1[l];
@@ -21127,7 +21127,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true); this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
$('.request_url', $(this.el)).html('<pre></pre>'); $('.request_url', $(this.el)).html('<pre></pre>');
$('.request_url pre', $(this.el)).text(this.invocationUrl); $('.request_url pre', $(this.el)).text(this.invocationUrl);
obj = {
// TODO: don't use jQuery. Use SwaggerJS for handling the call.
var obj = {
type: this.model.method, type: this.model.method,
url: this.invocationUrl, url: this.invocationUrl,
headers: headerParams, headers: headerParams,
@@ -21151,9 +21153,6 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
}; };
})(this) })(this)
}; };
if (window.authorizations) {
window.authorizations.apply(obj);
}
jQuery.ajax(obj); jQuery.ajax(obj);
return false; return false;
// end of file-upload nastiness // end of file-upload nastiness

File diff suppressed because one or more lines are too long

View File

@@ -325,7 +325,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// Note: This is compiled code // Note: This is compiled code
// TODO: Refactor // TODO: Refactor
handleFileUpload: function(map, form) { handleFileUpload: function(map, form) {
var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, obj, p, param, params, ref1, ref2, ref3, ref4; var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, p, param, params, ref1, ref2, ref3, ref4;
ref1 = form.serializeArray(); ref1 = form.serializeArray();
for (l = 0, len = ref1.length; l < len; l++) { for (l = 0, len = ref1.length; l < len; l++) {
o = ref1[l]; o = ref1[l];
@@ -363,7 +363,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true); this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
$('.request_url', $(this.el)).html('<pre></pre>'); $('.request_url', $(this.el)).html('<pre></pre>');
$('.request_url pre', $(this.el)).text(this.invocationUrl); $('.request_url pre', $(this.el)).text(this.invocationUrl);
obj = {
// TODO: don't use jQuery. Use SwaggerJS for handling the call.
var obj = {
type: this.model.method, type: this.model.method,
url: this.invocationUrl, url: this.invocationUrl,
headers: headerParams, headers: headerParams,
@@ -387,9 +389,6 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
}; };
})(this) })(this)
}; };
if (window.authorizations) {
window.authorizations.apply(obj);
}
jQuery.ajax(obj); jQuery.ajax(obj);
return false; return false;
// end of file-upload nastiness // end of file-upload nastiness