-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RequestTraceMiddleware in Hosting project.
- Loading branch information
1 parent
4f005a2
commit f1e001b
Showing
3 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Source/Euonia.Hosting/Middlewares/RequestTraceMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Nerosoft.Euonia.Hosting; | ||
|
||
public class RequestTraceMiddleware | ||
{ | ||
private readonly RequestDelegate _next; | ||
|
||
public RequestTraceMiddleware(RequestDelegate next) | ||
{ | ||
_next = next; | ||
} | ||
|
||
public async Task InvokeAsync(HttpContext context) | ||
{ | ||
context.Response.Headers.Add("x-request-trace-id", context.TraceIdentifier); | ||
|
||
await _next(context); | ||
} | ||
} |