Skip to content

Commit 9272872

Browse files
Fixed Instance property
- Fixed Instance property - Added method property
1 parent a980305 commit 9272872

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/RestExceptions/Extensions/ServiceCollectionExtensions.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ public static IServiceCollection AddRestExceptions(this IServiceCollection servi
2323
{
2424
options.CustomizeProblemDetails = context =>
2525
{
26-
context.ProblemDetails.Instance =
27-
$"[{context.HttpContext.Request.Method}] {context.HttpContext.Request.Path}";
26+
context.ProblemDetails.Instance = context.HttpContext.Request.Path;
27+
context.ProblemDetails.Extensions.Add("method", context.HttpContext.Request.Method);
2828
context.ProblemDetails.Extensions.Add("requestId", context.HttpContext.TraceIdentifier);
29-
30-
var activity = context.HttpContext.Features.Get<IHttpActivityFeature>()?.Activity;
31-
context.ProblemDetails.Extensions.TryAdd("traceId", activity?.Id);
29+
context.ProblemDetails.Extensions.TryAdd("traceId",
30+
context.HttpContext.Features.Get<IHttpActivityFeature>()?.Activity.Id);
3231
};
3332
});
3433
services.AddExceptionHandler<RestExceptionHandler>();

0 commit comments

Comments
 (0)