Add CV to response

This commit is contained in:
2024-08-16 17:27:33 +02:00
parent 92d6f47345
commit 8dbf2b2b94
2 changed files with 5 additions and 3 deletions
@@ -18,7 +18,7 @@ public sealed class CorrelationVectorMiddleware : IMiddleware
this.options = options.ThrowIfNull().Value.ThrowIfNull();
}
public Task InvokeAsync(HttpContext context, RequestDelegate next)
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
var cv = new CorrelationVector();
if (context.Items.TryGetValue(this.options.Header, out var correlationVectorVal) &&
@@ -29,6 +29,8 @@ public sealed class CorrelationVectorMiddleware : IMiddleware
}
context.SetCorrelationVector(cv);
return next(context);
await next(context);
context.Response.Headers.Append(this.options.Header, context.GetCorrelationVector().ToString());
}
}
@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<Version>0.6</Version>
<Version>0.6.1</Version>
<Authors>Alexandru Macocian</Authors>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>