title: Receive a PostAsync in FromBody as param
body: <p>I'm trying to read a JSON string from Web API controller that is send through a <code>HttpClient.PostAsync()</code> method. But for some reason the <code>RequestBody</code> is always <code>null</code>.</p>
  
  <p>My Request looks like this:</p>
  
  <pre><code>public string SendRequest(string requestUrl, StringContent content, HttpMethod httpMethod)
  {
      var client = new HttpClient { BaseAddress = new Uri(ServerUrl) };
      var uri = new Uri(ServerUrl + requestUrl); // http://localhost/api/test
  
      client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 
  
      HttpResponseMessage response;
      response = client.PostAsync(uri, content).Result;
  
      if (!response.IsSuccessStatusCode)
      {
          throw new ApplicationException(response.ToString());
      }
  
      string stringResult = response.Content.ReadAsStringAsync().Result;
      return stringResult;
  }
  </code></pre>
  
  <hr>
  
  <p>I call this method like this</p>
  
  <pre><code>var content = new StringContent(JsonConvert.SerializeObject(testObj), Encoding.UTF8, "application/json");
  string result = Request.SendRequest("/api/test", content, HttpMethod.Post);
  </code></pre>
  
  <hr>
  
  <p>Now currently my Web API controller method reads the send data like this:</p>
  
  <pre><code>[HttpPost]
  public string PostContract()
  {
      string httpContent = Request.Content.ReadAsStringAsync().Result;
      return httpContent;
  }
  </code></pre>
  
  <p>This works fine. The <code>stringResult</code> property contains the string returned by the controller method. But I'd like to have my controller method like this:</p>
  
  <pre><code>[HttpPost]
  public string PostContract([FromBody] string httpContent)
  {
      return httpContent;
  }
  </code></pre>
  
  <p>The request seems to be working, getting a <code>200 - OK</code>, but the <code>stringResult</code> from the <code>SendRequest</code> method is always <code>null</code>.</p>
  
  <p>Why isn't the method where I'm using the <code>RequestBody</code> as parameter not working?</p>