minio-dotnet icon indicating copy to clipboard operation
minio-dotnet copied to clipboard

Inject Ioc-managed HttpClient for MinioClient via constructor

Open PurplestViper opened this issue 3 years ago • 0 comments

In version 4.0.4 we had the MinioClient(HttpClient httpClient) constructor which unfortunately is now marked obsolete:

  • Having this function can easily use services.AddHttpClient<MinioClient>() to inject HttpClient.
  • The parameterless constructor creates an HttpClient instance. If another httpclient instance is subsequently passed in using the builder mode, we will have a garbage. Maybe we can simply set a switch, e.g. MinioClient(bool createHttpClient = true), to control whether to create in the constructor or not.

PurplestViper avatar Aug 12 '22 15:08 PurplestViper