Skip to content

Commit

Permalink
Encode slashes in path parameters
Browse files Browse the repository at this point in the history
This is a local version of swagger-api/swagger-js#280.
  • Loading branch information
gwicke committed Mar 9, 2015
1 parent 4a08d53 commit bfb5d91
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions dist/lib/swagger-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,22 +1171,8 @@ Operation.prototype.encodeQueryParam = function(arg) {
return encodeURIComponent(arg);
};

/**
* TODO revisit, might not want to leave '/'
**/
Operation.prototype.encodePathParam = function(pathParam) {
var encParts, part, parts, i, len;
pathParam = pathParam.toString();
if (pathParam.indexOf('/') === -1) {
return encodeURIComponent(pathParam);
} else {
parts = pathParam.split('/');
encParts = [];
for (i = 0, len = parts.length; i < len; i++) {
encParts.push(encodeURIComponent(parts[i]));
}
return encParts.join('/');
}
return encodeURIComponent(pathParam);
};

var Model = function(name, definition) {
Expand Down

0 comments on commit bfb5d91

Please sign in to comment.