Add project files.

This commit is contained in:
Sergio Matias Urquin
2025-04-29 18:57:20 -06:00
parent 62e9799537
commit d5925a6476
44 changed files with 2716 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Http;
namespace Core.Cerberos.Adapters.Extensions
{
public sealed class TrackingMechanismExtension : DelegatingHandler
{
private readonly IHttpContextAccessor _httpContextAccessor;
public TrackingMechanismExtension(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (_httpContextAccessor.HttpContext.Items.TryGetValue("TrackingId", out var trackingId))
{
request.Headers.Add("TrackingId", trackingId.ToString());
}
return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
}
}