I need a java program to generate the following request. I am using Apache HttpClient Library but still not able to produce a request like this:
This is what my python p
If you want to change the Http Header Accept-Encoding, you chang like this
httpPostRequest.setHeader("Accept-Encoding", "identity");
Your codes
final List nameValuePairs = new ArrayList(6);
nameValuePairs.add(new BasicNameValuePair("Host: ", "a.host.com");
nameValuePairs.add(new BasicNameValuePair("Accept-Encoding: ", "identity"));
nameValuePairs.add(new BasicNameValuePair("Content-Length: ", "6"));
httpPostRequest.setEntity(new UrlEncodedFormEntity(nameValuePairs));
are used to send the value pairs in the http request body, NOT IN THE HEADER