-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for region and edge values in url #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎆
@@ -20,7 +21,8 @@ func NewClient(accountSid string, authToken string) *twilio.Client { | |||
c := &twilio.Client{ | |||
Credentials: creds, | |||
HTTPClient: http.DefaultClient, | |||
BaseURL: "twilio.com", | |||
Edge: os.Getenv("TWILIO_EDGE"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test shouldn't be reading these values unless it's also clearing them before each test. Otherwise tests may fail (or pass in error) when set in the testing environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I add os.Setenv("TWILIO_EDGE", "")
, os.Setenv("TWILIO_REGION", "")
at the end of each the region/edge tests, that should work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of, but this is partially testing the logic that the test client can read from the env vars (not the actual client). I say avoid it if possible. Unless, for instance, you're testing that the actual client can read from the env vars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I was trying to test precedence, but I see that's already handled when setting c.Region
or c.Edge
, which is equivalent to setting those fields during instantiation of the client. I'll rip out the extraneous tests and submit a new PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related JIRA: https://issues.corp.twilio.com/browse/DI-960