I'm leveraging the new MVC4 ApiController to build out a search interface; something like this:
public IEnumerable<RecordSummaryType> Get( ... )
{
var list = MyService.GiveMeTheList( ... );
return list;
}
public SingleRecordDetailType Get(long id)
{
var result = MyService.GiveMeASingleValue(id);
return result;
}
For some reason, in this case the IEnumerable call honors content negotiation - i.e., when I pass application/xml in the request accept headers it returns XML, and when I pass application/json it returns JSON - but the SingleRecordType call only returns JSON, even if you ask for XML.
So my question is - are there differences in the way MVC 4 handles collections over single value types? Or, more likely, are there hooks in MVC where one can inadvertently disable content negotiation for certain calls?