From 8f6819645333e247184b66f75ed56c1fd5b30e18 Mon Sep 17 00:00:00 2001 From: Mark Robustelli <137117976+mark-robustelli@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:39:56 -0700 Subject: [PATCH 1/2] Update netcore.client.ftl Creating class which will allow the passing of an httpClient. --- src/main/client/netcore.client.ftl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/client/netcore.client.ftl b/src/main/client/netcore.client.ftl index a112d05a..7d3aee71 100644 --- a/src/main/client/netcore.client.ftl +++ b/src/main/client/netcore.client.ftl @@ -137,4 +137,22 @@ namespace io.fusionauth { return new DefaultRESTClient(host); } } + + public class HttpClientBuilder : IRESTClientBuilder + { + public HttpClient HTTP_CLIENT; + + public HttpClientBuilder(HttpClient httpClient) + { + HTTP_CLIENT = httpClient; + } + + public IRESTClient build(string host) + { + if (HTTP_CLIENT.BaseAddress == null) + { + HTTP_CLIENT.BaseAddress = new Uri(host); + } + return new DefaultRESTClient(HTTP_CLIENT); + } } From 6ee4e0c08a3c21e0d0ed5f0decc10da66d787056 Mon Sep 17 00:00:00 2001 From: Mark Robustelli <137117976+mark-robustelli@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:46:31 -0700 Subject: [PATCH 2/2] Update netcore.client.sync.ftl Updating to allow acceptance of httpClient. --- src/main/client/netcore.client.sync.ftl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/client/netcore.client.sync.ftl b/src/main/client/netcore.client.sync.ftl index 06c95e6f..51869cf2 100644 --- a/src/main/client/netcore.client.sync.ftl +++ b/src/main/client/netcore.client.sync.ftl @@ -50,8 +50,8 @@ namespace io.fusionauth { public class FusionAuthSyncClient : IFusionAuthSyncClient { public readonly FusionAuthClient client; - public FusionAuthSyncClient(string apiKey, string host, string tenantId = null) { - client = new FusionAuthClient(apiKey, host, tenantId); + public FusionAuthSyncClient(string apiKey, string host, string tenantId = null, IRESTClientBuilder clientBuilder = null) { + client = new FusionAuthClient(apiKey, host, tenantId, clientBuilder); } /**