RestSharp header removed from request when run in Xamarin iOS/Andorid

I created a library that use RestSharp for connect to my REST Server. In each request I added two custom header with name "Date" and "Auth". I run my library from a console ".NET 4" project and works perfect. Now I create two applications usign Xamarin (iOS and Andorid). I connect my library and I try to run one method. The connection works, but the custom header "Date" was not found. I dubug the app and the request object of RestSharp before send the request conatin the two headers. But when the request arrive to the server the "Date" header there is no more.

What could be the problem?

Here is the code:
public static void SendRequest(Action<bool> callback) { var request = new RestRequest ("/url/to/my/services/", Method.PUT); request.AddHeader("Accept", "application/json"); request.AddHeader("Content-Type", "application/json"); request.AddHeader ("Date", "MY DATE VALUE" ); request.AddHeader ("Auth", "MY AUTH VALUE" ); request.AddBody (my_json_var); _server.ExecuteAsync (request, response => { var json_response = JsonConvert.DeserializeObject<Dictionary<string, string>>(response.Content); if (response.StatusCode == System.Net.HttpStatusCode.NoContent || response.StatusCode == System.Net.HttpStatusCode.Created) callback(true); else callback(false); }); }

Thanks in advance.


Sign In or Register to comment.