Skip to content
Open
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
18 changes: 18 additions & 0 deletions src/main/client/netcore.client.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a host string is passed in, but the BaseAddress of the HTTP_CLIENT is already set, the parameter is effectively ignored. This might be an anti-pattern.

{
HTTP_CLIENT.BaseAddress = new Uri(host);
}
return new DefaultRESTClient(HTTP_CLIENT);
}
}
4 changes: 2 additions & 2 deletions src/main/client/netcore.client.sync.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down