updated oauth2 support into a single config

This commit is contained in:
Tony Tam
2014-03-20 15:38:30 -07:00
parent 2edd7ac058
commit 96c14e43a9
6 changed files with 99 additions and 35 deletions

19
dist/lib/swagger.js vendored
View File

@@ -1,5 +1,5 @@
// swagger.js
// version 2.0.26
// version 2.0.27
var __bind = function(fn, me){
return function(){
@@ -882,6 +882,21 @@ SwaggerOperation.prototype.pathXml = function() {
return this.path.replace("{format}", "xml");
};
SwaggerOperation.prototype.encodePathParam = function(pathParam) {
var encParts, part, parts, _i, _len;
if (pathParam.indexOf("/") === -1) {
return encodeURIComponent(pathParam);
} else {
parts = pathParam.split("/");
encParts = [];
for (_i = 0, _len = parts.length; _i < _len; _i++) {
part = parts[_i];
encParts.push(encodeURIComponent(part));
}
return encParts.join("/");
}
};
SwaggerOperation.prototype.urlify = function(args) {
var url = this.resource.basePath + this.pathJson();
var params = this.parameters;
@@ -891,7 +906,7 @@ SwaggerOperation.prototype.urlify = function(args) {
if(args[param.name]) {
// apply path params and remove from args
var reg = new RegExp('\{' + param.name + '[^\}]*\}', 'gi');
url = url.replace(reg, encodeURIComponent(args[param.name]));
url = url.replace(reg, this.encodePathParam(args[param.name]));
delete args[param.name];
}
else