AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Consumes Attribute 415 return format

Open Deasel011 opened this issue 3 years ago • 4 comments

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.

Deasel011 avatar Feb 22 '22 21:02 Deasel011

I think this might be a bug in the product. There are two filters at play here:

  1. The ConsumesAttribute resource filter.
  2. The ClientErrorResultFilter always-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?

serpent5 avatar Feb 23 '22 12:02 serpent5

@pranavkm @brunolins16 please review

Rick-Anderson avatar Feb 23 '22 18:02 Rick-Anderson

@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.

brunolins16 avatar Feb 24 '22 17:02 brunolins16

@Rick-Anderson this was fixed with the new ProblemDetailsService. Are you planning to add docs that covers it here #26685?

brunolins16 avatar Sep 19 '22 16:09 brunolins16

What would we add? We fixed a bug? Now that it's fixed it's not an issue.

Rick-Anderson avatar Sep 23 '22 23:09 Rick-Anderson

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.

brunolins16 avatar Sep 27 '22 18:09 brunolins16