Skip to content

Commit

Permalink
inject contextAccessor
Browse files Browse the repository at this point in the history
  • Loading branch information
kochengin.a committed Jul 3, 2024
1 parent 3fc8db1 commit 30cd5f5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ATI.Services.Consul/ConsulMetricsHttpClientWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using ATI.Services.Common.Options;
using ATI.Services.Common.Serializers;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using NLog;
Expand All @@ -34,7 +35,8 @@ public ConsulMetricsHttpClientWrapper(
BaseServiceOptions serviceOptions,
string adapterName,
IHttpClientFactory httpClientFactory,
MetricsFactory metricsFactory,
MetricsFactory metricsFactory,
IHttpContextAccessor httpContextAccessor,
JsonSerializerSettings newtonsoftSettings = null,
JsonSerializerOptions systemTextJsonOptions = null)
{
Expand All @@ -59,7 +61,7 @@ public ConsulMetricsHttpClientWrapper(
_clientConfig.Headers.TryAdd(header.Key, header.Value);
}

_clientWrapper = new MetricsHttpClientWrapper(_clientConfig, httpClientFactory);
_clientWrapper = new MetricsHttpClientWrapper(_clientConfig, httpClientFactory, httpContextAccessor);
}

public void SetSerializer(JsonSerializerSettings newtonsoftSettings)
Expand Down Expand Up @@ -364,7 +366,8 @@ public class ConsulMetricsHttpClientWrapper<T> : ConsulMetricsHttpClientWrapper
public ConsulMetricsHttpClientWrapper(
IOptions<T> serviceOptions,
IHttpClientFactory httpClientFactory,
MetricsFactory metricsFactory) : base(serviceOptions.Value, serviceOptions.Value.ConsulName, httpClientFactory, metricsFactory)
MetricsFactory metricsFactory,
IHttpContextAccessor httpContextAccessor) : base(serviceOptions.Value, serviceOptions.Value.ConsulName, httpClientFactory, metricsFactory, httpContextAccessor)
{
}
}
Expand Down

0 comments on commit 30cd5f5

Please sign in to comment.