Skip to content

Commit

Permalink
Squidex client library fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Oct 24, 2020
1 parent e249ba9 commit 600db1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageIcon>logo-squared.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Squidex/squidex/</PackageProjectUrl>
<Version>6.3.0</Version>
<Version>6.4.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.9" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,30 +167,34 @@ public HttpClient CreateHttpClient()
{
var url = new Uri(new Uri(Options.Url, UriKind.Absolute), "/api/");

var handler = new HttpClientHandler();

Options.Configurator.Configure(handler);

HttpMessageHandler messageHandler = new AuthenticatingHttpMessageHandler(Options.Authenticator)
{
InnerHandler = handler
};

messageHandler = Options.ClientFactory.CreateHttpMessageHandler(messageHandler);
var messageHandler = CreateHttpMessageHandler();

var httpClient = Options.ClientFactory.CreateHttpClient(messageHandler);

if (httpClient == null)
{
httpClient = new HttpClient(handler, false)
{
BaseAddress = url
};
httpClient = new HttpClient(messageHandler, false);
}

httpClient.BaseAddress = url;

Options.Configurator.Configure(httpClient);

return httpClient;
}

private HttpMessageHandler CreateHttpMessageHandler()
{
var handler = new HttpClientHandler();

Options.Configurator.Configure(handler);

HttpMessageHandler messageHandler = new AuthenticatingHttpMessageHandler(Options.Authenticator)
{
InnerHandler = handler
};

return Options.ClientFactory.CreateHttpMessageHandler(messageHandler) ?? messageHandler;
}
}
}

0 comments on commit 600db1c

Please sign in to comment.