title: Get the raw request that is sent with HttpClient and HttpRequestMessage
body: <p>In my C# code running .NET 6 (Azure Function) I am sending an <code>HttpRequestMessage</code> using <code>HttpClient</code>. It doesn't work but it should work, so I want to get the <strong>raw</strong> request that I am sending, including the header, so I can compare with the documentation and see the differences.</p>
  <p>In the past I have used Fiddler but it doesn't work for me now, probably because of some security settings on my laptop. So I am looking for a solution within the world of Visual Studio 2022 or .NET 6 where I can get the raw request out for troubleshooting purposes.</p>
  <p>This question is not really about code, but here is my code anyway.</p>
  <pre><code>HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, &quot;https://myendpoint.com/rest/something&quot;);
  
  var apiToken = &quot;AOU9FrasdgasdfagtHJNV&quot;;
  request.Headers.Add(&quot;Authorization&quot;, &quot;Basic &quot; + apiToken);
  
  var message = new
  {
      sender = &quot;Hey&quot;,
      message = &quot;Hello world&quot;,
      recipients = new[] { new { id = 12345678} }
  };
  
  request.Content = new StringContent(JsonSerializer.Serialize(message), Encoding.UTF8, &quot;application/json&quot;);
  request.Headers.Add(&quot;Accept&quot;, &quot;application/json, text/javascript&quot;);
  HttpResponseMessage response = await httpClient.SendAsync(request);
  </code></pre>
  <p>When <code>SendAsync</code> is invoked, I wish to know what exactly is sent, both header and content.</p>