Skip to content

Customizing ProblemDetails via CustomizeProblemDetails extension method #210

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}";
    };
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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