Add project files.
This commit is contained in:
		
							
								
								
									
										18
									
								
								Core.Cerberos.External/TrackingMechanismExtension.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Core.Cerberos.External/TrackingMechanismExtension.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| using Microsoft.AspNetCore.Http; | ||||
|  | ||||
| namespace Core.Cerberos.External | ||||
| { | ||||
|     public sealed class TrackingMechanismExtension(IHttpContextAccessor httpContextAccessor) : DelegatingHandler | ||||
|     { | ||||
|         private readonly IHttpContextAccessor _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor)); | ||||
|  | ||||
|         protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | ||||
|         { | ||||
|             if (_httpContextAccessor.HttpContext != null) | ||||
|             { | ||||
|                 request.Headers.Add("TrackingId", Guid.NewGuid().ToString()); | ||||
|             } | ||||
|             return await base.SendAsync(request, cancellationToken).ConfigureAwait(false); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin