title: C# Post XML file using RestSharp
body: <p>I have written a method to post messages to an uri. </p>
  
  <pre><code>public string RestClientPost(string uri, string message = null)
      {
          var client = new RestClient(uri);
          var request = new RestRequest(Method.POST);
          request.AddHeader("Accept", "text/xml");
          if (!string.IsNullOrEmpty(message))
              request.AddParameter(message, ParameterType.RequestBody);
  
          var result = "";
          var response = client.Execute(request);
  
          if (response.StatusCode == HttpStatusCode.OK)
          {
              result = response.Content;
              Console.WriteLine(result);
          }
          else
          {
              result = response.StatusCode.ToString();
          }
  
  
          return result;
      }
  </code></pre>
  
  <p>and below code is used above method to post.</p>
  
  <pre><code>public void test123()
      {
          string uri = "myuri"; //private uri, cannot expose.
          var file= System.IO.File.ReadAllText(Path.Combine(Settings.EnvValPath, "RestClientXML", "test.XML"));
          var content = new RestClientServices().RestClientPost(uri, file);
  
      }
  </code></pre>
  
  <p>however, it returns "Unsupported Media type". </p>
  
  <p>my test.XML's content is </p>
  
  <pre><code>&lt;customer&gt; 
      &lt;customerName&gt;test&lt;/customerName &gt; 
      &lt;customerStatus&gt;OK&lt;/customerStatus &gt; 
  &lt;/customer&gt;
  </code></pre>
  
  <p>And using Advanced Rest Client Plugin for Google Chrome, I'm able to post it and return with string that I wanted. Is there something wrong?? I set "content-type" to "text/xml" in Advanced Rest Client. </p>
  
  <ul>
  <li>The return message is id of the customer. e.g: 2132</li>
  </ul>