mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-16 16:36:46 +01:00
18 lines
513 B
C#
18 lines
513 B
C#
// Copyright © WireMock.Net
|
|
#if NET5_0_OR_GREATER
|
|
using System;
|
|
using System.Net.Http;
|
|
using WireMock.Server;
|
|
|
|
namespace WireMock.Http;
|
|
|
|
internal class WireMockHttpClientFactory(WireMockServer server, params DelegatingHandler[] handlers) : IHttpClientFactory
|
|
{
|
|
private readonly Lazy<HttpClient> _lazyHttpClient = new(() => server.CreateClient());
|
|
|
|
public HttpClient CreateClient(string name)
|
|
{
|
|
return handlers.Length > 0 ? server.CreateClient(handlers) : _lazyHttpClient.Value;
|
|
}
|
|
}
|
|
#endif |