Skip to content

Commit

Permalink
Fix issue swagger-api#1132 "JS error when testing uploadFile method (h…
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen1 committed Apr 14, 2015
1 parent 673fca9 commit 5315da8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions swagger-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -20692,7 +20692,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
} else {

// Default validator
this.model.validatorUrl = 'http://online.swagger.io/validator';
this.model.validatorUrl = window.location.protocol + '//online.swagger.io/validator';
}
}
},
Expand Down Expand Up @@ -21089,7 +21089,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// Note: This is compiled code
// TODO: Refactor
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();
for (l = 0, len = ref1.length; l < len; l++) {
o = ref1[l];
Expand Down Expand Up @@ -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);
$('.request_url', $(this.el)).html('<pre></pre>');
$('.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,
url: this.invocationUrl,
headers: headerParams,
Expand All @@ -21151,9 +21153,6 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
};
})(this)
};
if (window.authorizations) {
window.authorizations.apply(obj);
}
jQuery.ajax(obj);
return false;
// end of file-upload nastiness
Expand Down
Loading

0 comments on commit 5315da8

Please sign in to comment.