Closed Swimburger closed 1 year ago
Thank you @IEvangelist for the guidance and support!
I added the recommended overload following options guidance for library authors: https://learn.microsoft.com/en-us/dotnet/core/extensions/options-library-authors Closes #117
To limit the amount of permutations of overloads, I decided to remove the provideHttpClient
parameter.
I added it originally to make sure it could be provided by the user to override our default implementation using the HTTP client factory, but in hindsight, there's not really a benefit and nobody asked for it.
Users can still customize the HTTP client by overriding the "Twilio" named HTTP client like this:
builder.Services.AddTwilioClient();
builder.Services.AddHttpClient("Twilio")
.ConfigureHttpClient(client =>
{
client.BaseAddress = new Uri("YOUR_PROXY_ADDRESS");
})
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
// same options as the Twilio C# SDK
AllowAutoRedirect = false
});
Previously,
TwilioClientOptions
andTwilioRequestValidationOptions
would be configured during startup and would not automatically change when the .NET configuration is changed. With these changes, these options will update when configuration from configuration sources withreloadOnChange
enabled are changed.Additionally, the options are now validated using the built-in validation APIs.
Contributing to Twilio