Skip to content

Customizing ProblemDetails via CustomizeProblemDetails extension methodΒ #210

@andrei-micuda

Description

@andrei-micuda

Is there an equivalent to the CustomizeProblemDetails extension method provided by Microsoft.AspNetCore.Http.Extensions? For example, I would like to automatically populate the Instance field of all ProblemDetails objects based on the values present on HttpContext. Something like the snippet below:

builder.Services.AddProblemDetails(options =>
{
    options.CustomizeProblemDetails = context =>
    {
        context.ProblemDetails.Instance =
            $"{context.HttpContext.Request.Method} {context.HttpContext.Request.Path}";
    };
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions