Skip to content

Commit

Permalink
fix: Don't overwrite parameters when building request (twilio#141)
Browse files Browse the repository at this point in the history
In the case of 'target-account-sid', it was being overwritten by 'account-sid'
if both flags were provided. 'account-sid' should already be captured by the
path parameter.
  • Loading branch information
childish-sambino committed Nov 21, 2019
1 parent abf6188 commit edc3da9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/services/twilio-api/api-command-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class ApiCommandRunner {
addParameter(parameter, params) {
const flag = getFlagConfig(parameter, this.actionDefinition);

if (doesObjectHaveProperty(this.flagValues, flag.name)) {
// Add the param if it does't exist already and we have a value to add.
if (!doesObjectHaveProperty(params, parameter.name) && doesObjectHaveProperty(this.flagValues, flag.name)) {
params[parameter.name] = this.flagValues[flag.name];
}
}
Expand Down
1 change: 1 addition & 0 deletions test/base-commands/twilio-api-command.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ describe('base-commands', () => {
.stderr()
.twilioCreateCommand(getCommandClass(numberUpdateActionDefinition), [
'--sid', fakeCallResponse.sid,
'--account-sid', 'AC012',
'--target-account-sid', 'AC123'
])
.do(ctx => {
Expand Down

0 comments on commit edc3da9

Please sign in to comment.