Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

Can't set the answer_method when updating an app #73

Closed sammachin closed 8 years ago

sammachin commented 8 years ago

when I update an app and set —answer_method POST it doesn’t put an & in the query string so answer_method=POST gets added to the URL

Sams-Air:~ smachin$ nexmo app:update 26afecbf-28cb-42f5-b4a3-f1e98cb7de91 VAPI_Voicemail http://sammachin.ngrok.io/call http://sammachin.ngrok.io/call --answer_method POST --debug
{ host: 'api.nexmo.com',
  port: 443,
  path: '/beta/account/applications/26afecbf-28cb-42f5-b4a3-f1e98cb7de91?name=VAPI_Voicemail&type=voice&answer_url=http://sammachin.ngrok.io/call&event_url=http://sammachin.ngrok.io/callanswer_method=POST&&api_key=XXX&api_secret=XXX',
  method: 'PUT',
  headers: 
   { 'Content-Type': 'application/x-www-form-urlencoded',
     accept: 'application/json' } }
response ended
Validator.response() - Error: 
null
Validator.response() - Response: 
{ id: '26afecbf-28cb-42f5-b4a3-f1e98cb7de91',
  name: 'VAPI_Voicemail',
  voice: { webhooks: [ [Object], [Object] ] },
  keys: { public_key: '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnRW29LazggDtIeiD0TV5\n+/Xv0jjbYSoKKa4m4K6RVk+b2WW6HFCUkIM0GDAwws7L5MRObfQD2Q5BRyH6idwY\n7eKxqsNJQ0Ut5IaQQZHMsOKDUl/FbuXOjzjR8NkSuqb7BmC/ZuVuwhI5CHV449AM\nJmD07gV9VkwpX3toTb66D3v1AZJxdErZFbmQvOKNXYBe858ojfCfZzRGpTqxf7AJ\ngAiSWCprkgwxDD1JahQri1o2vknuI4H5q4MyXHXo3ysvoBU1gYiQN5WiilCI3xGD\nPFv1QzS1RAH1rivH6KY7eQ7GolK5pVYGy4F/tEsP065pkJXzd7NLlgA7KK6H0xhn\nEQIDAQAB\n-----END PUBLIC KEY-----\n' },
  _links: { self: { href: '/applications/26afecbf-28cb-42f5-b4a3-f1e98cb7de91' } } }
End Validator.response()
Application updated: 26afecbf-28cb-42f5-b4a3-f1e98cb7de91
sammachin commented 8 years ago

in the PUT request there is the value answer_method=POST&& seems like the & is in the wrong place

cbetta commented 8 years ago

@sammachin odd enough works for me

cbetta commented 8 years ago

Oh wait it doesn't error. It just doesn't do it right

cbetta commented 8 years ago

Probably a problem in the Node lib. Checking

cbetta commented 8 years ago

Problem is also there in app:create

cbetta commented 8 years ago

@sammachin https://github.com/Nexmo/nexmo-node/pull/60 solves the problem. If you can push people to merge it we can update the dependency here too.