title: Logging request/response messages when using HttpClient
body: <p>I have a method that does a POST like below</p>
  
  <pre><code>var response = await client.PostAsJsonAsync(url, entity);
  
  if (response.IsSuccessStatusCode)
  {
          // read the response as strongly typed object
          return await response.Content.ReadAsAsync&lt;T&gt;();
  }
  </code></pre>
  
  <p>My question is how can I obtain the actual JSON that got posted from the entity object. I would like to log the JSON that gets POSTED, so it will be nice to have that without me having to do a json serialize myself.</p>