However, I can say that it does not work as before. I am using the client against a WCF REST API, and for that I have previously found out that I need an XmlDataContractSerializer, which I have written and use. This class first implemented ISerializer and IDeserializer, but after updating to 106.5 (not 106.6, the one before that), it needed to implement IXmlSerializer, but as the interface was already implemented it was merely a matter of adding it and recompiling. This was due to a change to the RestRequest.XmlSerializer type. Once this was updated and compiled it worked as before.
When updating to version 106.x there was no need to change anything, just recompile, but the code:
client = new RestClient(host);
var request = new RestRequest(location.PathAndQuery, method);
request.XmlSerializer = new XmlDataContractSerializer();
request.RequestFormat = DataFormat.Xml;
client.AddHandler("text/xml", new XmlDataContractSerializer());
client.AddHandler("application/xml", new XmlDataContractSerializer());
stopped working when sending objects to the API. Receiving objects worked as before.
I experimented with different solutions, and found that changing the XmlDataContractSerializer to implement IRestSerializer and adding UseSerializer, as below
client = new RestClient(host);
var request = new RestRequest(location.PathAndQuery, method);
request.XmlSerializer = new XmlDataContractSerializer();
request.RequestFormat = DataFormat.Xml;
client.AddHandler("text/xml", new XmlDataContractSerializer());
client.AddHandler("application/xml", new XmlDataContractSerializer());
client.UseSerializer(new XmlDataContractSerializer());
made the code work again. However, I have not been able to find any examples using UseSerializer, so whether the above, which works, is also the recommended way is the question. Also, the return value of UseSerializer is IRestClient? Can the client returned be different from the client supplied, or can the return value be ignored? And perhaps the UseDotNetXmlSerializer is what I should use instead of using my own - I will experiment with that. Then I just need to find out what to pass to AddHandler.
Is there a better place for finding RestSharp documentation and examples? As for documentation, I meant in the code, the others have method description.
From IRestClient:
.
.
.
//
// Summary:
// Removes custom deserialzier for the specified content type
//
// Parameters:
// contentType:
// Content type for which deserializer needs to be removed
void RemoveHandler(string contentType);
IRestClient UseSerializer(IRestSerializer serializer);
Thank you again for your note, it was very helpful.