proper encoding of query params

This commit is contained in:
Ayush Gupta
2012-07-17 00:10:28 -07:00
parent 56c83c5624
commit 77493426f6
2 changed files with 6 additions and 12 deletions

9
dist/lib/swagger.js vendored
View File

@@ -389,20 +389,17 @@
if (includeApiKey == null) {
includeApiKey = true;
}
return this.getMatchingParams(['header'], args, includeApiKey, false);
return this.getMatchingParams(['header'], args, includeApiKey);
};
SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args, includeApiKey, urlEncode) {
SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args, includeApiKey) {
var matchingParams, param, _i, _len, _ref;
if (urlEncode == null) {
urlEncode = true;
}
matchingParams = {};
_ref = this.parameters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
if ((jQuery.inArray(param.paramType, paramTypes) >= 0) && args[param.name]) {
matchingParams[param.name] = urlEncode ? encodeURIComponent(args[param.name]) : args[param.name];
matchingParams[param.name] = args[param.name];
}
}
if (includeApiKey && (this.resource.api.api_key != null) && this.resource.api.api_key.length > 0) {

View File

@@ -389,20 +389,17 @@
if (includeApiKey == null) {
includeApiKey = true;
}
return this.getMatchingParams(['header'], args, includeApiKey, false);
return this.getMatchingParams(['header'], args, includeApiKey);
};
SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args, includeApiKey, urlEncode) {
SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args, includeApiKey) {
var matchingParams, param, _i, _len, _ref;
if (urlEncode == null) {
urlEncode = true;
}
matchingParams = {};
_ref = this.parameters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
if ((jQuery.inArray(param.paramType, paramTypes) >= 0) && args[param.name]) {
matchingParams[param.name] = urlEncode ? encodeURIComponent(args[param.name]) : args[param.name];
matchingParams[param.name] = args[param.name];
}
}
if (includeApiKey && (this.resource.api.api_key != null) && this.resource.api.api_key.length > 0) {