fix: Fix setApiKey and setTwilioEmailAuth to prevent overwriting baseUrl #1386
+21
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
If you use
setDefaultRequest
to changebaseUrl
to a custom value, and executesetDefaultRequest
beforesetApiKey
, thebaseUrl
that you thought you had changed to a custom value will be overwritten withSENDGRID_BASE_URL
.For example, if you want to send a request to a mock SendGrid prepared in a local environment, you need to be careful about the execution order of
setApiKey
andsetDefaultRequest
as follows.In order to resolve it, I've decided to make the following changes, including
setTwilioEmailAuth
, which has a similar dependency:setDefaultRequest('baseUrl', SENDGRID_BASE_URL)
insidesetApiKey
since the default value forbaseUrl
isSENDGRID_BASE_URL
.setDefaultRequest('baseUrl', TWILIO_BASE_URL)
insidesetTwilioEmailAuth
depending on whetherbaseUrl
has been updated to a custom value.Checklist
If you have questions, please file a support ticket.