Browse Source
Update AbpCorrelationIdMiddleware.cs
pull/17224/head
maliming
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
12 additions and
0 deletions
-
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs
|
|
|
@ -29,6 +29,18 @@ public class AbpCorrelationIdMiddleware : IMiddleware, ITransientDependency |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual string GetCorrelationIdFromRequest(HttpContext context) |
|
|
|
{ |
|
|
|
string correlationId = context.Request.Headers[_options.HttpHeaderName]; |
|
|
|
if (correlationId.IsNullOrEmpty()) |
|
|
|
{ |
|
|
|
correlationId = Guid.NewGuid().ToString("N"); |
|
|
|
context.Request.Headers[_options.HttpHeaderName] = correlationId; |
|
|
|
} |
|
|
|
|
|
|
|
return correlationId; |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void CheckAndSetCorrelationIdOnResponse( |
|
|
|
HttpContext httpContext, |
|
|
|
AbpCorrelationIdOptions options, |
|
|
|
|