aspnet / Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
5.62k stars 2.14k forks source link

unsupported content types do not elicit a 415 Media Type Unsupported code #8602

Closed patrickboe closed 6 years ago

patrickboe commented 6 years ago

Is this a Bug or Feature request?:

Bug

Steps to reproduce (preferably a link to a GitHub repo with a repro project):

https://github.com/patrickboe/media_type_bug

Description of the problem:

Making a request to a web api project which specifies an unsupported content type produces a "400 Bad Request" instead of "415 Media Type Unsupported" response because of the application order of action filters on the default MVC request pipeline. If a content type we can't read is specified, the more specific 415 error should be prioritized and served to the user.

Version of Microsoft.AspNetCore.Mvc or Microsoft.AspNetCore.App or Microsoft.AspNetCore.All:

Razor.Design 2.1.2

khellang commented 6 years ago

This has already been fixed. See https://github.com/aspnet/Mvc/issues/8236 and https://github.com/aspnet/Mvc/pull/8246