title: UrlEncodedFormEntity not working as expected
body: <p>I am trying to make a POST request in java, and this is not working as expected.</p>
  
  <p>Following <a href="https://stackoverflow.com/a/3325065/1790644">this post</a>, here is the code that I currently have</p>
  
  <pre><code>UrlEncodedFormEntity entity = new UrlEncodedFormEntity(data, Consts.UTF_8);
  </code></pre>
  
  <p>What I can not understand, is that while debugging this, <code>data</code>, is an <code>ArrayList&lt;NameValuePair&gt;</code> which the debugger shows a value of</p>
  
  <blockquote>
    <p>[Content-Type=text/json, Authorization=Bearer bZXL7hwy5vo7YnbiiGogKy6WTyCmioi8]</p>
  </blockquote>
  
  <p>Which is completely expected, where I am at a complete loss, is that after this call, the value of entity is,</p>
  
  <blockquote>
    <p>[Content-Type: application/x-www-form-urlencoded; charset=UTF-8,Content-Length: 78,Chunked: false]</p>
  </blockquote>
  
  <p>The call has done absolutely nothing but ignore the data I passed it.</p>
  
  <p>What have I done wrong here?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>More Code</p>
  
  <p><em>Caller</em></p>
  
  <pre><code>    String authURL = "https://api.ecobee.com/1/thermostat";
      authURL += "?format=json&amp;body=" + getSelection();
  
      // request headers
      ArrayList&lt;BasicNameValuePair&gt; nvps = new ArrayList&lt;BasicNameValuePair&gt;();
      nvps.add(new BasicNameValuePair("Content-Type", "text/json"));
      nvps.add(new BasicNameValuePair("Authorization", "Bearer " + code));
  
      // make the api call
      String apiResponse = HttpUtils.makeRequest(RequestMethod.POST, authURL, nvps);
  </code></pre>
  
  <p><em>makeRequest</em> method</p>
  
  <pre><code>public static String makeRequest(RequestMethod method, String url, ArrayList&lt;BasicNameValuePair&gt; data) {
  
      try {
  
          CloseableHttpClient httpClient = HttpClients.createDefault();
          HttpRequestBase request = null;
  
          switch (method) {
  
          case POST:
  
              // new post request
              request = new HttpPost(url);
  
              // encode the post data
              UrlEncodedFormEntity entity = new UrlEncodedFormEntity(data, Consts.UTF_8); // &lt;-- this is where I have the issue
              ((HttpPost) request).setEntity(entity);
              break;
  
              ...
  </code></pre>