Skip to content

Make ProblemDetailsDefaults public #47822

Closed
@Tornhoof

Description

@Tornhoof

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am trying to create ProblemDetails, e.g.ValidationProblemDetails outside of a normal Http Request.
The rather nice default values, e.g.Type String, which is according to the RFC the correct way to identify it, are applied via

public static void Apply(ProblemDetails problemDetails, int? statusCode)
{
// We allow StatusCode to be specified either on ProblemDetails or on the ObjectResult and use it to configure the other.
// This lets users write <c>return Conflict(new Problem("some description"))</c>
// or <c>return Problem("some-problem", 422)</c> and have the response have consistent fields.
if (problemDetails.Status is null)

Unfortunately the type is not public, but internal.

Describe the solution you'd like

It would be rather useful, as ProblemDetails is public, to make that one public too, so I don't need to copy the logic around.

Additional context

Alternatively a new method could be added to IProblemDetailsService to allow access to the defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresenhancementThis issue represents an ask for new feature or an enhancement to an existing one

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions