We should allow the user to enter a URL with or without a slash, and strip it if it exists.
Possible Solution
We should be able to add some code to server-client in the constructor to clean this up, as well as in the main server-sdk package. It would need to be done in both places as server-client handles it for all the sub-packages, but the main package doesn't extend from there so it also needs to handle it.
Steps to Reproduce (for bugs)
Create a new Vonage object and set the base URL to https://api.nexmo.com/
Try and hit a resource using that URL like applications
Expected Behavior
According to https://developer.vonage.com/messages/code-snippets/whatsapp/send-text, you can set the base URL for the API to
https://api.nexmo.com/
, with a trailing slash. This breaks the routing as the SDK expects the URL without a/
at the end.Current Behavior
We should allow the user to enter a URL with or without a slash, and strip it if it exists.
Possible Solution
We should be able to add some code to
server-client
in the constructor to clean this up, as well as in the mainserver-sdk
package. It would need to be done in both places asserver-client
handles it for all the sub-packages, but the main package doesn't extend from there so it also needs to handle it.Steps to Reproduce (for bugs)
Vonage
object and set the base URL tohttps://api.nexmo.com/
Context
Submitted by a user in our internal devrel chat
Your Environment