title: How to Async httpclient with Patch Method
body: <p>I am trying to consume [this API] (<a href="https://docs.microsoft.com/en-us/rest/api/vsts/release/approvals/update" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/vsts/release/approvals/update</a>). Below is my code, but i am getting 400 bad request.</p>
  
  <pre><code>HttpContent z = new StringContent("{\"status\": \"approved\",\"comments\": \"" + Request.QueryString["comment"].ToString() + "\"}", Encoding.UTF8, "application/json");                    
  
  public static async  Task PatchAsync(Uri requestUri, HttpContent content)
  {
      try
      {                 
          using (HttpClient client = new HttpClient())
          {
              var method = new HttpMethod("PATCH");
              var request = new HttpRequestMessage(method, requestUri)
              {
                  Content = content
              };
  
              client.DefaultRequestHeaders.Accept.Add(
                  new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
  
              client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
                  Convert.ToBase64String(
                      System.Text.ASCIIEncoding.ASCII.GetBytes(
                          string.Format("{0}:{1}", "", "XXXXXXXXX"))));
  
              //using (HttpResponseMessage response = await client.PostAsync(requestUri, content))
              using (HttpResponseMessage response = await client.SendAsync(request))
              {
                  response.EnsureSuccessStatusCode();
                  string responseBody = await response.Content.ReadAsStringAsync();
                  respApproval = responseBody;
              }
          }
      }
      catch (Exception ex)
      {
          respApproval = ex.ToString();
      }
  }
  </code></pre>