Merge pull request #4540 from sbwalker/dev

set BaseAddress for IHttpClientFactory
This commit is contained in:
Shaun Walker 2024-08-20 15:22:39 -04:00 committed by GitHub
commit fdb217d5c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,6 +35,7 @@ namespace Oqtane.Services
if (_factory != null)
{
var client = _factory.CreateClient("oqtane");
client.BaseAddress = new Uri(_siteState.Alias.Protocol + _siteState.Alias.Name);
if (!client.DefaultRequestHeaders.Contains(Constants.AntiForgeryTokenHeaderName) && _siteState != null && !string.IsNullOrEmpty(_siteState.AntiForgeryToken))
{
client.DefaultRequestHeaders.Add(Constants.AntiForgeryTokenHeaderName, _siteState.AntiForgeryToken);