Browse Source

Update AbpCorrelationIdMiddleware.cs

pull/17220/head
Engincan VESKE 3 years ago
parent
commit
deee66c9c0
  1. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs

@ -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