ASP.NET WebAPI Supported Media Types per Method
问题 Given a method in a controller: public class CustomerController : ApiController { [HttpGet] public CustomerDto GetById([FromUri] int id) { . . return customerDto } } Is there a way to specify supported Media Types with an attribute? For instance, CustomerDto is a complex class and will only serialize with JSON (application/json) not XML (application/xml) but could also accept PDF (application/pdf). Is there something like this: [HttpGet(Accepts.JSON, Accepts.PDF)] or [HttpGet][AcceptJSON]