fix for https://github.com/swagger-api/swagger-js/issues/210, #814, query param encoding issue
This commit is contained in:
33
dist/lib/swagger-client.js
vendored
33
dist/lib/swagger-client.js
vendored
@@ -1,8 +1,9 @@
|
|||||||
// swagger-client.js
|
|
||||||
// version 2.1.0-alpha.5
|
|
||||||
/**
|
/**
|
||||||
* Array Model
|
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
|
||||||
**/
|
* @version v2.1.0-alpha.5
|
||||||
|
* @link http://swagger.io
|
||||||
|
* @license apache 2.0
|
||||||
|
*/
|
||||||
var ArrayModel = function(definition) {
|
var ArrayModel = function(definition) {
|
||||||
this.name = "name";
|
this.name = "name";
|
||||||
this.definition = definition || {};
|
this.definition = definition || {};
|
||||||
@@ -57,6 +58,7 @@ ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SwaggerAuthorizations applys the correct authorization to an operation being executed
|
* SwaggerAuthorizations applys the correct authorization to an operation being executed
|
||||||
*/
|
*/
|
||||||
@@ -157,7 +159,8 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
|
|||||||
var base64encoder = this._btoa;
|
var base64encoder = this._btoa;
|
||||||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
||||||
return true;
|
return true;
|
||||||
};var __bind = function(fn, me){
|
};
|
||||||
|
var __bind = function(fn, me){
|
||||||
return function(){
|
return function(){
|
||||||
return fn.apply(me, arguments);
|
return fn.apply(me, arguments);
|
||||||
};
|
};
|
||||||
@@ -238,6 +241,7 @@ Object.keys = Object.keys || (function () {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PrimitiveModel
|
* PrimitiveModel
|
||||||
**/
|
**/
|
||||||
@@ -289,7 +293,8 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnVal;
|
return returnVal;
|
||||||
};var SwaggerClient = function(url, options) {
|
};
|
||||||
|
var SwaggerClient = function(url, options) {
|
||||||
this.isBuilt = false;
|
this.isBuilt = false;
|
||||||
this.url = null;
|
this.url = null;
|
||||||
this.debug = false;
|
this.debug = false;
|
||||||
@@ -316,6 +321,7 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
if (typeof options.useJQuery === 'boolean')
|
if (typeof options.useJQuery === 'boolean')
|
||||||
this.useJQuery = options.useJQuery;
|
this.useJQuery = options.useJQuery;
|
||||||
|
|
||||||
|
this.supportedSubmitMethods = options.supportedSubmitMethods || [];
|
||||||
this.failure = options.failure != null ? options.failure : function() {};
|
this.failure = options.failure != null ? options.failure : function() {};
|
||||||
this.progress = options.progress != null ? options.progress : function() {};
|
this.progress = options.progress != null ? options.progress : function() {};
|
||||||
this.spec = options.spec;
|
this.spec = options.spec;
|
||||||
@@ -763,7 +769,7 @@ Operation.prototype.supportHeaderParams = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Operation.prototype.supportedSubmitMethods = function () {
|
Operation.prototype.supportedSubmitMethods = function () {
|
||||||
return this.resource.api.supportedSubmitMethods;
|
return this.parent.supportedSubmitMethods;
|
||||||
};
|
};
|
||||||
|
|
||||||
Operation.prototype.getHeaderParams = function (args) {
|
Operation.prototype.getHeaderParams = function (args) {
|
||||||
@@ -1111,11 +1117,8 @@ Operation.prototype.encodeQueryCollection = function(type, name, value) {
|
|||||||
return encoded;
|
return encoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO this encoding needs to be changed
|
|
||||||
**/
|
|
||||||
Operation.prototype.encodeQueryParam = function(arg) {
|
Operation.prototype.encodeQueryParam = function(arg) {
|
||||||
return escape(arg);
|
return encodeURIComponent(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1378,6 +1381,7 @@ e.PasswordAuthorization = PasswordAuthorization;
|
|||||||
e.CookieAuthorization = CookieAuthorization;
|
e.CookieAuthorization = CookieAuthorization;
|
||||||
e.SwaggerClient = SwaggerClient;
|
e.SwaggerClient = SwaggerClient;
|
||||||
e.Operation = Operation;
|
e.Operation = Operation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SwaggerHttp is a wrapper for executing requests
|
* SwaggerHttp is a wrapper for executing requests
|
||||||
*/
|
*/
|
||||||
@@ -1389,6 +1393,10 @@ SwaggerHttp.prototype.execute = function(obj) {
|
|||||||
else
|
else
|
||||||
this.useJQuery = this.isIE8();
|
this.useJQuery = this.isIE8();
|
||||||
|
|
||||||
|
if(obj && typeof obj.body === 'object') {
|
||||||
|
obj.body = JSON.stringify(obj.body);
|
||||||
|
}
|
||||||
|
|
||||||
if(this.useJQuery)
|
if(this.useJQuery)
|
||||||
return new JQueryHttpClient().execute(obj);
|
return new JQueryHttpClient().execute(obj);
|
||||||
else
|
else
|
||||||
@@ -1563,7 +1571,8 @@ ShredHttpClient.prototype.execute = function(obj) {
|
|||||||
data: response.content.data
|
data: response.content.data
|
||||||
};
|
};
|
||||||
|
|
||||||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
|
var headers = response._headers.normalized || response._headers;
|
||||||
|
var contentType = (headers["content-type"]||headers["Content-Type"]||null)
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
6
dist/swagger-ui.js
vendored
6
dist/swagger-ui.js
vendored
@@ -271,7 +271,7 @@ function program1(depth0,data) {
|
|||||||
stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
||||||
if(stack2 || stack2 === 0) { buffer += stack2; }
|
if(stack2 || stack2 === 0) { buffer += stack2; }
|
||||||
buffer += "</div>\n ";
|
buffer += "</div>\n ";
|
||||||
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfService), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
||||||
if(stack2 || stack2 === 0) { buffer += stack2; }
|
if(stack2 || stack2 === 0) { buffer += stack2; }
|
||||||
buffer += "\n ";
|
buffer += "\n ";
|
||||||
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
|
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
|
||||||
@@ -286,7 +286,7 @@ function program2(depth0,data) {
|
|||||||
|
|
||||||
var buffer = "", stack1;
|
var buffer = "", stack1;
|
||||||
buffer += "<div class=\"info_tos\"><a href=\""
|
buffer += "<div class=\"info_tos\"><a href=\""
|
||||||
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfService)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
||||||
+ "\">Terms of service</a></div>";
|
+ "\">Terms of service</a></div>";
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
@@ -1785,7 +1785,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
|||||||
|
|
||||||
OperationView.prototype.render = function() {
|
OperationView.prototype.render = function() {
|
||||||
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, signatureModel, statusCode, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref10, _ref11, _ref5, _ref6, _ref7, _ref8, _ref9;
|
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, signatureModel, statusCode, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref10, _ref11, _ref5, _ref6, _ref7, _ref8, _ref9;
|
||||||
isMethodSubmissionSupported = true;
|
isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
|
||||||
if (!isMethodSubmissionSupported) {
|
if (!isMethodSubmissionSupported) {
|
||||||
this.model.isReadOnly = true;
|
this.model.isReadOnly = true;
|
||||||
}
|
}
|
||||||
|
|||||||
2
dist/swagger-ui.min.js
vendored
2
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,8 +1,9 @@
|
|||||||
// swagger-client.js
|
|
||||||
// version 2.1.0-alpha.5
|
|
||||||
/**
|
/**
|
||||||
* Array Model
|
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
|
||||||
**/
|
* @version v2.1.0-alpha.5
|
||||||
|
* @link http://swagger.io
|
||||||
|
* @license apache 2.0
|
||||||
|
*/
|
||||||
var ArrayModel = function(definition) {
|
var ArrayModel = function(definition) {
|
||||||
this.name = "name";
|
this.name = "name";
|
||||||
this.definition = definition || {};
|
this.definition = definition || {};
|
||||||
@@ -57,6 +58,7 @@ ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SwaggerAuthorizations applys the correct authorization to an operation being executed
|
* SwaggerAuthorizations applys the correct authorization to an operation being executed
|
||||||
*/
|
*/
|
||||||
@@ -157,7 +159,8 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
|
|||||||
var base64encoder = this._btoa;
|
var base64encoder = this._btoa;
|
||||||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
||||||
return true;
|
return true;
|
||||||
};var __bind = function(fn, me){
|
};
|
||||||
|
var __bind = function(fn, me){
|
||||||
return function(){
|
return function(){
|
||||||
return fn.apply(me, arguments);
|
return fn.apply(me, arguments);
|
||||||
};
|
};
|
||||||
@@ -238,6 +241,7 @@ Object.keys = Object.keys || (function () {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PrimitiveModel
|
* PrimitiveModel
|
||||||
**/
|
**/
|
||||||
@@ -289,7 +293,8 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnVal;
|
return returnVal;
|
||||||
};var SwaggerClient = function(url, options) {
|
};
|
||||||
|
var SwaggerClient = function(url, options) {
|
||||||
this.isBuilt = false;
|
this.isBuilt = false;
|
||||||
this.url = null;
|
this.url = null;
|
||||||
this.debug = false;
|
this.debug = false;
|
||||||
@@ -316,6 +321,7 @@ PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
if (typeof options.useJQuery === 'boolean')
|
if (typeof options.useJQuery === 'boolean')
|
||||||
this.useJQuery = options.useJQuery;
|
this.useJQuery = options.useJQuery;
|
||||||
|
|
||||||
|
this.supportedSubmitMethods = options.supportedSubmitMethods || [];
|
||||||
this.failure = options.failure != null ? options.failure : function() {};
|
this.failure = options.failure != null ? options.failure : function() {};
|
||||||
this.progress = options.progress != null ? options.progress : function() {};
|
this.progress = options.progress != null ? options.progress : function() {};
|
||||||
this.spec = options.spec;
|
this.spec = options.spec;
|
||||||
@@ -763,7 +769,7 @@ Operation.prototype.supportHeaderParams = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Operation.prototype.supportedSubmitMethods = function () {
|
Operation.prototype.supportedSubmitMethods = function () {
|
||||||
return this.resource.api.supportedSubmitMethods;
|
return this.parent.supportedSubmitMethods;
|
||||||
};
|
};
|
||||||
|
|
||||||
Operation.prototype.getHeaderParams = function (args) {
|
Operation.prototype.getHeaderParams = function (args) {
|
||||||
@@ -1111,11 +1117,8 @@ Operation.prototype.encodeQueryCollection = function(type, name, value) {
|
|||||||
return encoded;
|
return encoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO this encoding needs to be changed
|
|
||||||
**/
|
|
||||||
Operation.prototype.encodeQueryParam = function(arg) {
|
Operation.prototype.encodeQueryParam = function(arg) {
|
||||||
return escape(arg);
|
return encodeURIComponent(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1378,6 +1381,7 @@ e.PasswordAuthorization = PasswordAuthorization;
|
|||||||
e.CookieAuthorization = CookieAuthorization;
|
e.CookieAuthorization = CookieAuthorization;
|
||||||
e.SwaggerClient = SwaggerClient;
|
e.SwaggerClient = SwaggerClient;
|
||||||
e.Operation = Operation;
|
e.Operation = Operation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SwaggerHttp is a wrapper for executing requests
|
* SwaggerHttp is a wrapper for executing requests
|
||||||
*/
|
*/
|
||||||
@@ -1389,6 +1393,10 @@ SwaggerHttp.prototype.execute = function(obj) {
|
|||||||
else
|
else
|
||||||
this.useJQuery = this.isIE8();
|
this.useJQuery = this.isIE8();
|
||||||
|
|
||||||
|
if(obj && typeof obj.body === 'object') {
|
||||||
|
obj.body = JSON.stringify(obj.body);
|
||||||
|
}
|
||||||
|
|
||||||
if(this.useJQuery)
|
if(this.useJQuery)
|
||||||
return new JQueryHttpClient().execute(obj);
|
return new JQueryHttpClient().execute(obj);
|
||||||
else
|
else
|
||||||
@@ -1563,7 +1571,8 @@ ShredHttpClient.prototype.execute = function(obj) {
|
|||||||
data: response.content.data
|
data: response.content.data
|
||||||
};
|
};
|
||||||
|
|
||||||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
|
var headers = response._headers.normalized || response._headers;
|
||||||
|
var contentType = (headers["content-type"]||headers["Content-Type"]||null)
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
468
lib/swagger.js
468
lib/swagger.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user