Skip to content

Set content-type to application/problem+json for generic TypedResults with T=ProblemDetails #58574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
mikekistler opened this issue Oct 22, 2024 · 1 comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-openapi

Comments

@mikekistler
Copy link
Contributor

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.

Currently when an endpoint returns a generic TypedResults with T=ProblemDetails, such as NotFound<ProblemDetails>,
the content-type is set to application/json instead of application/problem+json.

The endpoint could set the content-type manually, but it would be nice if the framework could do this automatically.

Note that the generated OpenAPI document currently shows the response as application/json, which is correct
as long as the endpoint does not set the content-type manually.

Describe the solution you'd like

Set the content-type application/problem+json for TypedResults with T=ProblemDetails and reflect this in the OpenAPI document.

Additional context

No response

@ghost ghost added the old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Oct 22, 2024
@mikekistler mikekistler added feature-openapi area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels labels Oct 22, 2024
@mikekistler
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-openapi
Projects
None yet
Development

No branches or pull requests

1 participant