1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

PM-10600: HttpClientFactory fixture returns the same HttpClient instance.

The IHttpClientFactory.CreateClient(string name) needs to return different HttpClient instances in case there are multiple clients to be created. This have been issue for BaseIdentityClientService where the HttpClient is modified with BaseAddress, causing issues.
This commit is contained in:
Maciej Zieniuk 2024-11-08 15:29:51 +00:00
parent b19f85e4db
commit 676f10b832
No known key found for this signature in database
GPG Key ID: 9CACE59F1272ACD9

View File

@ -18,7 +18,7 @@ public class HttpClientFactoryBuilder : ISpecimenBuilder
{
var handler = context.Create<MockedHttpMessageHandler>();
var httpClientFactory = Substitute.For<IHttpClientFactory>();
httpClientFactory.CreateClient(Arg.Any<string>()).Returns(handler.ToHttpClient());
httpClientFactory.CreateClient(Arg.Any<string>()).Returns(_ => handler.ToHttpClient());
return httpClientFactory;
}