We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e1b7d3f commit 9a7d499Copy full SHA for 9a7d499
1 file changed
Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.WebApi/Interceptors/CorrelationInterceptor.cs
@@ -0,0 +1,17 @@
1
+namespace Comanda.Orchestrator.WebApi.Interceptors;
2
+
3
+public sealed class CorrelationInterceptor(IHttpContextAccessor accessor) : DelegatingHandler
4
+{
5
+ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
6
+ {
7
+ var correlation = accessor.HttpContext?.Items[Headers.Correlation]?.ToString();
8
9
+ if (!string.IsNullOrWhiteSpace(correlation))
10
11
+ request.Headers.Remove(Headers.Correlation);
12
+ request.Headers.Add(Headers.Correlation, correlation);
13
+ }
14
15
+ return await base.SendAsync(request, cancellationToken);
16
17
+}
0 commit comments