You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
I have a controller action decorated with [Produces("application/vnd.my-app+json; version=1")]
I have a custom OutputFormatter that will say it CanWriteResult as long as the content type is application/vnd.my-app+json, regardless of media type parameter values
I send a fetch to the controller action from my browser's console with an Accept header value of application/vnd.derp and receive a 200 response with a Content-Type header value of application/vnd.my-app; version=1
The expected behavior
I would expect content negotiation to honor the Accept request header in all cases and respond with 406 whenever it cannot locate a formatter that applies to a media type specified in the Accept header, rather than responding with whatever it can muster up even when the client has explicitly declared what it will accept.
Possible workaround
In RC2, the OutputFormatterWriteContext exposes the HttpContext. A custom formatter could take advantage of that in order to properly respect the Accept header value, but this breaks the current negotiator/formatter pattern and causes the formatter to violate the Single Responsibility Principle.
In RC1, well, there's nothing that easy that I can see offhand.