diff --git a/src/Ocelot/Requester/HttpClientBuilder.cs b/src/Ocelot/Requester/HttpClientBuilder.cs index bbb93d2cca..2b0cff47a5 100644 --- a/src/Ocelot/Requester/HttpClientBuilder.cs +++ b/src/Ocelot/Requester/HttpClientBuilder.cs @@ -9,6 +9,13 @@ namespace Ocelot.Requester { + public interface IHttpClientBuilder { } + public interface IHttpClientCache + { + IHttpClient Get(DownstreamRoute cacheKey); + void Set(DownstreamRoute cacheKey, IHttpClient client, TimeSpan span); + } + public class HttpClientBuilder : IHttpClientBuilder { private readonly IDelegatingHandlerHandlerFactory _factory; @@ -65,7 +72,7 @@ public IHttpClient Create(DownstreamRoute downstreamRoute) Timeout = timeout, }; - _client = new HttpClientWrapper(_httpClient, downstreamRoute.ConnectionClose); + _client = new HttpClientWrapper(_httpClient, downstreamRoute.ConnectionClose); // TODO return _client; } diff --git a/src/Ocelot/Requester/HttpClientWrapper.cs b/src/Ocelot/Requester/HttpClientWrapper.cs index 33e8df80a1..42d7e1685d 100644 --- a/src/Ocelot/Requester/HttpClientWrapper.cs +++ b/src/Ocelot/Requester/HttpClientWrapper.cs @@ -4,6 +4,8 @@ namespace Ocelot.Requester { + public interface IHttpClient { } + /// /// This class was made to make unit testing easier when HttpClient is used. /// @@ -11,17 +13,17 @@ public class HttpClientWrapper : IHttpClient { public HttpClient Client { get; } - public bool ConnectionClose { get; } + public bool ConnectionClose { get; } // TODO public HttpClientWrapper(HttpClient client, bool connectionClose = false) { Client = client; - ConnectionClose = connectionClose; + ConnectionClose = connectionClose; // TODO } public Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken = default) { - request.Headers.ConnectionClose = ConnectionClose; + request.Headers.ConnectionClose = ConnectionClose; // TODO return Client.SendAsync(request, cancellationToken); } }