You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A better solution is to implement IHttpClientFactory. Your ShipEngineClient constructor could take an instance of this. That would make it easy to adapt to applications that use dependency injection.
Thanks! We are reviewing this - it sounds like there were some changes earlier this year that should have resolved this issue, but we're going to double check and clear up anything we missed. We'll close this when that is merged in.
You are absolutely right that this was an issue, until our 2.2.1 release in June 2024.
We added the new constructor so that you could pass in an HttpClient instance that you manage yourself or obtain from IHttpClientFactory. We did not remove the existing constructors that create their own instance as we did not want to break compatibility. This is something we are considering for the 3.x release.
This article You're using HttpClient wrong and it's destabilizing your software describes the problem. Their solution is to share a single instance of
HttpClient
.A better solution is to implement
IHttpClientFactory
. YourShipEngineClient
constructor could take an instance of this. That would make it easy to adapt to applications that use dependency injection.Here's the documentation for
IHttpClientFactory
.The text was updated successfully, but these errors were encountered: