title: getting 'Bad Request' while consuming json webservice using httpclient C#
body: <p>I am getting bad StatusCode: 400, ReasonPhrase: 'Bad Request' with the below code.</p>
  
  <pre><code>string url = "http://1.1.1.1";
  Object cu = new Object ();
  HttpClient client = new HttpClient { BaseAddress = new Uri(url) };
  var json = JsonConvert.SerializeObject(cu);
  client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  var content = new StringContent(JsonConvert.SerializeObject(cu), Encoding.UTF8, "application/json");
  var response = client.PostAsJsonAsync("/api", content); //changed content from cu
  var status = response.Result;
  </code></pre>
  
  <p>I noticed my status code's Content-Type: is still text/html instead of application/json.</p>
  
  <p>Please assist.</p>
  
  <p>Note: edited code above mentioned in comments. 
  Also I am able to consume service by the below jquery. But I need the C# code to work.</p>
  
  <pre><code>    $.ajax({
           cache: false,
           type: "POST",
           async: true,
           url: RequestUrl,
           data: JSON.stringify(jData),
           contentType: "application/json",
           dataType: "json",
           success: function (result) {
               alert(result.ResultCode);
           },
           error: function (result) {
               alert('error' + result.responseText);
           }
       });
  </code></pre>