I am trying to use ODataLib for OData protocol V4 (Microsoft.OData.Core) to generate payload in Atom format. I ensured that Content-Type and Accept headers refer application/atom+xml, however a call to CreateODataEntryWriter always result in exception:
Microsoft.OData.Core.ODataContentTypeException : A supported MIME type could not be found that matches the acceptable MIME types for the request. The supported type(s) 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false, application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true, application/json;odata.metadata=minimal;odata.streaming=true, application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false, application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true, application/json;odata.metadata=minimal;odata.streaming=false, application/json;odata.metadata=minimal;IEEE754Compatible=false, application/json;odata.metadata=minimal;IEEE754Compatible=true, application/json;odata.metadata=minimal, application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false, application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true, application/json;odata.metadata=full;odata.streaming=true, application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false, application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatib...' do not match any of the acceptable MIME types 'application/atom+xml'.
Here's the sample code that cause the exception:
var writerSettings = new ODataMessageWriterSettings();
writerSettings.SetContentType(ODataFormat.Atom);
var messageWriter = new ODataMessageWriter(request, writerSettings, model);
var entryWriter = messageWriter.CreateODataEntryWriter();
I inspected the library code and found that ODataMessageWriterSettings has a property EnableAtom but this property is declared as internal, and it doesn't seem to be set from inside the library, so it looks like it is always false. I know that Atom format is obsolete in OData V4, is it supported for entry payload generation?