I made a post about this on Stackoverflow and never received an answer. Here is the link to the post https://stackoverflow.com/questions/48994951/apache-httpclient-include-boundary-in-multipart-form-data
Here is what I am stuck on 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. 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); any idea how this is done?