Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
11 changes: 9 additions & 2 deletions src/FluentlyHttpClient/FluentHttpClientFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace FluentlyHttpClient;
namespace FluentlyHttpClient;

/// <summary>
/// HTTP client factory which contains registered HTTP clients and able to get existing or creating new ones.
Expand Down Expand Up @@ -54,6 +54,11 @@ public interface IFluentHttpClientFactory
/// <param name="identifier">Identifier to check.</param>
/// <returns>Returns true when already exists.</returns>
bool Has(string identifier);

/// <summary>
/// Get the amount of clients registered.
/// </summary>
int Count { get; }
}

/// <summary>
Expand All @@ -62,9 +67,11 @@ public interface IFluentHttpClientFactory
public class FluentHttpClientFactory : IFluentHttpClientFactory
{
private readonly IServiceProvider _serviceProvider;
private readonly Dictionary<string, IFluentHttpClient> _clientsMap = new();
private readonly Dictionary<string, IFluentHttpClient> _clientsMap = [];
private Action<FluentHttpClientBuilder>? _configure;

public int Count => _clientsMap.Count;

/// <summary>
/// Initializes a new instance of <see cref="FluentHttpClientFactory"/>.
/// </summary>
Expand Down