Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Fixing an exception when the header already exists (#29)
Browse files Browse the repository at this point in the history
Fixing an exception when the header already exists
  • Loading branch information
ejcoyle88 authored Nov 8, 2019
2 parents d69e401 + fc30f7c commit 900281c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,15 @@ private string GetCorrelationId()
var correlationId = string.IsNullOrEmpty(header)
? Guid.NewGuid().ToString()
: header;

_contextAccessor.HttpContext.Response.Headers.Add(_headerKey, correlationId);

#if NETFULL
if(!_contextAccessor.HttpContext.Response.Headers.AllKeys.Contains(_headerKey))
#else
if (!_contextAccessor.HttpContext.Response.Headers.ContainsKey(_headerKey))
#endif
{
_contextAccessor.HttpContext.Response.Headers.Add(_headerKey, correlationId);
}

return correlationId;
}
Expand Down

0 comments on commit 900281c

Please sign in to comment.