title: Apache HttpClient include boundary in multipart/form-data
body: <p>I have the following POST request which is supposed to upload a file. But I can not figure out how to include the boundary in the request for the "Content-Type" header.</p>
  
  <pre><code>HttpPost request = new HttpPost(url);
  request.setConfig(config);
  
  StringEntity params = new StringEntity("");
  
  HttpEntity entity = MultipartEntityBuilder.create()
          .addBinaryBody("blob", file, ContentType.create("application/octet-stream"), "filename").build();
  
  request.addHeader("Host", "upload.twitter.com");
  request.addHeader("Connection", "keep-alive");
  request.addHeader("User-Agent", userAgent);
  request.addHeader("Content-Type",  ????????);
  request.addHeader("Accept", "*/*");
  request.addHeader("Accept-Encoding", "gzip, deflate, br");
  request.addHeader("Accept-Language", "en-US,en;q=0.9");
  request.addHeader("Cookie", cookies);
  
  request.setEntity(entity);
  response = httpClient.execute(request);
  
  int responseCode = response.getStatusLine().getStatusCode();
  
  System.out.println("upload response code: " + responseCode);
  </code></pre>
  
  <p>any idea how this is done?</p>