Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs
  • Loading branch information
JamesNK committed Dec 13, 2023
commit 2cb6eb9db42b5854191cef0be8ce25da96eec460
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ public void RequestEnd(HttpContext httpContext, Exception? exception, HostingApp
if (context.MetricsEnabled)
{
var endpoint = httpContext.GetEndpoint();
if (httpContext.Items.TryGetValue(HttpExtensions.ClearedEndpointKey, out var e) && e is Endpoint clearedEndpoint)
// Some middleware re-executing the pipeline. Before they do this, they clear the endpoint.
// The original endpoint is stashed with a known key in HttpContext.Items. Use it as a fallback.
if (endpoint is null && httpContext.Items.TryGetValue(HttpExtensions.ClearedEndpointKey, out var e) && e is Endpoint clearedEndpoint)
{
endpoint = clearedEndpoint;
}
Expand Down