minio-dotnet
minio-dotnet copied to clipboard
Inject Ioc-managed HttpClient for MinioClient via constructor
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.