Skip to content

Commit 2682bd9

Browse files
feat(http client factory): expose Count
1 parent 29c2288 commit 2682bd9

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Fluently Http Changelog
22

3-
[_vNext_](https://github.com/sketch7/FluentlyHttpClient/compare/3.8.1...3.9.0) (2020-X-X)
3+
[_vNext_](https://github.com/sketch7/FluentlyHttpClient/compare/4.0.1...4.1.0) (2024-X-X)
4+
5+
## [4.0.1](https://github.com/sketch7/FluentlyHttpClient/compare/4.0.0...4.0.1) (2024-08-28)
6+
7+
### Features
8+
9+
- **http client factory:** expose `Count` to know how many clients are registered
410

511
## [4.0.0](https://github.com/sketch7/FluentlyHttpClient/compare/3.9.6...4.0.0) (2024-07-24)
612

src/FluentlyHttpClient/FluentHttpClientFactory.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace FluentlyHttpClient;
1+
namespace FluentlyHttpClient;
22

33
/// <summary>
44
/// HTTP client factory which contains registered HTTP clients and able to get existing or creating new ones.
@@ -54,6 +54,11 @@ public interface IFluentHttpClientFactory
5454
/// <param name="identifier">Identifier to check.</param>
5555
/// <returns>Returns true when already exists.</returns>
5656
bool Has(string identifier);
57+
58+
/// <summary>
59+
/// Get the amount of clients registered.
60+
/// </summary>
61+
int Count { get; }
5762
}
5863

5964
/// <summary>
@@ -62,9 +67,11 @@ public interface IFluentHttpClientFactory
6267
public class FluentHttpClientFactory : IFluentHttpClientFactory
6368
{
6469
private readonly IServiceProvider _serviceProvider;
65-
private readonly Dictionary<string, IFluentHttpClient> _clientsMap = new();
70+
private readonly Dictionary<string, IFluentHttpClient> _clientsMap = [];
6671
private Action<FluentHttpClientBuilder>? _configure;
6772

73+
public int Count => _clientsMap.Count;
74+
6875
/// <summary>
6976
/// Initializes a new instance of <see cref="FluentHttpClientFactory"/>.
7077
/// </summary>

0 commit comments

Comments
 (0)