Consumes Attribute 415 return format
Hi there, is there a reason why the Consumes does not return a 415 formatted by a ProblemDetails? The rest of the page implies that if you do not want a ProblemDetail, you have to Suppress it. Why is the 415 returned by the Consumes Attribute not also returning a ProblemDetails unless explicitly suppressed when the Content-Type is malformed?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: b391017f-25e1-d5e1-c4f7-020408ade7b5
- Version Independent ID: 263a7b64-2e42-bbfc-c1d3-61680438e1e4
- Content: Create web APIs with ASP.NET Core
- Content Source: aspnetcore/web-api/index.md
- Product: aspnet-core
- Technology: aspnetcore-webapi
- GitHub Login: @Rick-Anderson
- Microsoft Alias: scaddie
I think this might be a bug in the product. There are two filters at play here:
- The
ConsumesAttributeresource filter. - The
ClientErrorResultFilteralways-run result filter.
The ConsumesAttribute short-circuits the filter pipeline. When that happens, the ClientErrorResultFilter, which is responsible for making the ProblemDetails response, doesn't run.
@Rick-Anderson How should we handle this?
@pranavkm @brunolins16 please review
@Rick-Anderson probably this is one of the scenarios we will need to review as part of https://github.com/dotnet/aspnetcore/issues/32957.
It is assigned to me right now and we are planning to work on it later in .NET 7.
@Rick-Anderson this was fixed with the new ProblemDetailsService. Are you planning to add docs that covers it here #26685?
What would we add? We fixed a bug? Now that it's fixed it's not an issue.
Actually, there is nothing in the docs that saying PD will not be generated for 415, so, maybe we don't need to add anything here other than what you have done already.