Set RestSharp Content-Type application/atom+xml;type=entry
Solution 1:
The AddXmlBody
method adds an object, which RestSharp will serialize to XML and send the serialized body. It doesn't suppose to be used with a pre-serialized payload.
If you want to send a pre-serialized string, you need to use AddStringBody(serializedString, contentType)
.
The AddStringBody
is just a wrapper of adding a new BodyParameter
instance:
public static RestRequest AddStringBody(this RestRequest request, string body, string contentType)
=> request.AddParameter(new BodyParameter("", body, Ensure.NotEmpty(contentType, nameof(contentType))));
You can use request.AddParameter(new BodyParameter(...))
if you need the body parameter to have a specific name.