diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a1025..0f73fd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Fluently Http Changelog -[_vNext_](https://github.com/sketch7/FluentlyHttpClient/compare/3.8.1...3.9.0) (2020-X-X) +[_vNext_](https://github.com/sketch7/FluentlyHttpClient/compare/4.0.1...4.1.0) (2024-X-X) + +## [4.0.1](https://github.com/sketch7/FluentlyHttpClient/compare/4.0.0...4.0.1) (2024-08-28) + +### Features + +- **http client factory:** expose `Count` to know how many clients are registered ## [4.0.0](https://github.com/sketch7/FluentlyHttpClient/compare/3.9.6...4.0.0) (2024-07-24) diff --git a/src/FluentlyHttpClient/FluentHttpClientFactory.cs b/src/FluentlyHttpClient/FluentHttpClientFactory.cs index 3959ae8..0489f9e 100644 --- a/src/FluentlyHttpClient/FluentHttpClientFactory.cs +++ b/src/FluentlyHttpClient/FluentHttpClientFactory.cs @@ -1,4 +1,4 @@ -namespace FluentlyHttpClient; +namespace FluentlyHttpClient; /// /// HTTP client factory which contains registered HTTP clients and able to get existing or creating new ones. @@ -54,6 +54,11 @@ public interface IFluentHttpClientFactory /// Identifier to check. /// Returns true when already exists. bool Has(string identifier); + + /// + /// Get the amount of clients registered. + /// + int Count { get; } } /// @@ -62,9 +67,11 @@ public interface IFluentHttpClientFactory public class FluentHttpClientFactory : IFluentHttpClientFactory { private readonly IServiceProvider _serviceProvider; - private readonly Dictionary _clientsMap = new(); + private readonly Dictionary _clientsMap = []; private Action? _configure; + public int Count => _clientsMap.Count; + /// /// Initializes a new instance of . ///