Merge pull request #91 from predicador37/master
Fixes Issue #68 in a generic way for any param with any regex
This commit is contained in:
@@ -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.";
|
||||||
|
|||||||
Reference in New Issue
Block a user