Update AbpCorrelationIdMiddleware.cs

pull/17220/head
Engincan VESKE 2 years ago
parent ef6fb0acaf
commit deee66c9c0

@ -29,11 +29,11 @@ public class AbpCorrelationIdMiddleware : IMiddleware, ITransientDependency
protected virtual void CheckAndSetCorrelationIdOnResponse(
HttpContext httpContext,
AbpCorrelationIdOptions options,
string correlationId)
string? correlationId)
{
httpContext.Response.OnStarting(() =>
{
if (options.SetResponseHeader && !httpContext.Response.Headers.ContainsKey(options.HttpHeaderName))
if (options.SetResponseHeader && !httpContext.Response.Headers.ContainsKey(options.HttpHeaderName) && !string.IsNullOrWhiteSpace(correlationId))
{
httpContext.Response.Headers[options.HttpHeaderName] = correlationId;
}

Loading…
Cancel
Save