Explorar el Código

proper encoding of query params

bubble
Ayush Gupta hace 12 años
padre
commit
77493426f6
Se han modificado 2 ficheros con 6 adiciones y 12 borrados
  1. +3
    -6
      dist/lib/swagger.js
  2. +3
    -6
      lib/swagger.js

+ 3
- 6
dist/lib/swagger.js Ver fichero

@@ -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) {


+ 3
- 6
lib/swagger.js Ver fichero

@@ -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) {


Cargando…
Cancelar
Guardar