MediaTypeFormatter.SetDefaultContentHeaders doesn't receive the runtime type of the object being serialized


ODataFormatter sends different response content type header depending on the type of the object being serialized. For example, serializing a Product might send "application/atom-xml;odata=entry" and serializing a collection of Products would send "application/atom-xml; odata=feed".


HongmeiG wrote Mar 19, 2013 at 6:47 PM

It is incorrect to send the declared type here. We should use the runtime type.

eilonlipton wrote May 7, 2013 at 6:51 PM

This is a breaking change but we do think it is important. However, the problem is larger than just the type passed into this method: Much of the formatter system takes in declared types instead of instance types, and if we change the system, we have to change it everywhere.