title: HTTP Post Request from C# to Flask REST API won't attach any parameters?
body: <p>I have been attempting to do a simple POST request to a basic Flask API, and no matter what I try it simply will do <code>http://localhost:5000/</code> rather than the <code>http://localhost/?test_key=test_value</code> that I want it to do. C# is not my strongest language, but I have tried a bunch of different methods that I found online. I don't think it has to do with my method being bad at this point, I more so think that I'm missing a major piece entirely.</p>
  
  <p>Here is the most recent attempt I tried (keep in mind this is a snippet of a far larger project, but it doesn't involve any other pieces of it):</p>
  
  <pre><code>    class DisputeResponse
      {
          public int id;
          public string res;
          public string test_key;
      }
  
      [HttpPost]
      public async Task&lt;JsonResult&gt; TestResponse(int id, string res)
      {
          HttpClient client = new HttpClient();
  
          client.BaseAddress = new Uri("http://localhost:5000/");
          client.DefaultRequestHeaders.Accept.Clear();
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
          try
          {
              var dispRes = new DisputeResponse();
              dispRes.test_key = "test_value";
  
              var result = await client.PostAsync("http://localhost:5000/",
                  new StringContent(JsonConvert.SerializeObject(dispRes), Encoding.UTF8, "application/json"
                  ));
  
              result.EnsureSuccessStatusCode();
          }
          catch (Exception e)
          {
              System.Diagnostics.Trace.TraceInformation(e.Message);
          }
  
  
          return null;
      }
  </code></pre>
  
  <p>Here is the output when I use Postman (works perfectly):<br/>
  <code>127.0.0.1 - - [15/Apr/2019 16:26:28] "POST /?test_key=test_value HTTP/1.1" 200 -</code></p>
  
  <p>And here is when I try to use C# code:<br/>
  <code>127.0.0.1 - - [15/Apr/2019 16:36:54] "POST / HTTP/1.1" 500 -</code></p>
  
  <p>EDIT: Sorry I had some extraneous lines that I removed.</p>