fixes https://github.com/wordnik/swagger-core/issues/68 in a generic way. Should work with all params.

This commit is contained in:
predicador37
2012-11-20 09:28:03 +01:00
parent fc320397e9
commit 30886478d4

View File

@@ -572,8 +572,8 @@
param = _ref[_i]; param = _ref[_i];
if (param.paramType === 'path') { if (param.paramType === 'path') {
if (args[param.name]) { if (args[param.name]) {
url = url.replace(/{id.*/, '{id}'); reg = new RegExp('\{'+param.name+'[^\}]*\}', 'gi');
url = url.replace("{" + param.name + "}", encodeURIComponent(args[param.name])); url = url.replace(reg, encodeURIComponent(args[param.name]));
delete args[param.name]; delete args[param.name];
} else { } else {
throw "" + param.name + " is a required path param."; throw "" + param.name + " is a required path param.";