How can I write a response in middleware using the same settings as returning an ObjectResult from a controller?
How can I return a response in ASP.NET Core MVC middleware using MVC's content negotiation?