From b4c737924b0236ad03e655806c487c875268a9e9 Mon Sep 17 00:00:00 2001 From: "Dudek, Daniel" Date: Wed, 13 Jul 2016 10:46:21 +0200 Subject: [PATCH] Extending ExecuteActionFilterAsync which is now using GetCorrelationId method from Request to get the CorrelationId. --- CorrelatorSharp.WebApi/CorrelationIdActionFilter.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CorrelatorSharp.WebApi/CorrelationIdActionFilter.cs b/CorrelatorSharp.WebApi/CorrelationIdActionFilter.cs index 28b63d2..3d8d154 100644 --- a/CorrelatorSharp.WebApi/CorrelationIdActionFilter.cs +++ b/CorrelatorSharp.WebApi/CorrelationIdActionFilter.cs @@ -31,6 +31,9 @@ public Task ExecuteActionFilterAsync(HttpActionContext acti if (headers != null && headers.TryGetValues(CORRELATION_ID_HTTP_HEADER, out correlationHeaderValues)) correlationId = correlationHeaderValues.FirstOrDefault(value => !String.IsNullOrWhiteSpace(value)); + if (String.IsNullOrWhiteSpace(correlationId)) + correlationId = actionContext.Request.GetCorrelationId().ToString(); + if (String.IsNullOrWhiteSpace(correlationId)) correlationId = Guid.NewGuid().ToString();