title: How to convert curl request to HttpClient
body: <p>I have a curl request that looks like this:</p>
  
  <pre><code>curl -i -XPOST 'http://my_url:port/write?db=myDb' -u user:xxxxx --data-binary 'FieldName,host=M.233 value=52.666 timestamp'
  </code></pre>
  
  <p>I'm trying to post this request using HttpClient. I'm not sure how exactly I should call it. This is what I tried to do:</p>
  
  <pre><code>public async void  TestHttpClient()
  { 
      var client = new HttpClient();
      var credentials = Encoding.ASCII.GetBytes("user:xxxxx");
      var header = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(credentials));
      client.DefaultRequestHeaders.Authorization = header;
      client.BaseAddress = new Uri("http://my_url:port/write?db=myDb");
      var result = await client.PostAsync(..);
  }
  </code></pre>
  
  <p>Which parameters should I write for PostAsync()?</p>
  
  <p>How to convert <code>--data-binary</code> and <code>FieldName,host=M.233 value=52.666 timestamp</code> from curl to HttpClient?</p>