Skip to content

Commit 9d33522

Browse files
committed
Fixed Issue with missing params
1 parent e7b50ab commit 9d33522

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions/Action.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ export default class Action {
5151
let endpoint = `${model.methodConf.http.url}${model.methodConf.methods[type].http.url}`;
5252
let params = _.map(endpoint.match(/(\/?)(\:)([A-z]*)/gm), (param) => { return param.replace('/', '') })
5353

54-
_.forEach(params, (param) => { endpoint = endpoint.replace(param, config.params[param.replace(':', '')] || '').replace('//', '/') })
54+
_.forEach(params, (param) => {
55+
const paramValue = _.has(config.params, param.replace(':', '')) ? config.params[param.replace(':', '')] : ''
56+
endpoint = endpoint.replace(param, paramValue).replace('//', '/')
57+
})
5558
if (config.query) endpoint += `?${Object.keys(config.query).map(k => `${encodeURIComponent(k)}=${encodeURIComponent(config.query[k])}`).join('&')}`;
5659
return endpoint;
5760
}

0 commit comments

Comments
 (0)