Java: Display request of an HttpURLConnection before sending
I want to make some API calls to a server using HttpURLConnection . But the requests are not successful, returning: <error> <http_status>400 Bad Request</http_status> <message>Unexpected request Content-Type header ''. Expecting 'application/x-www-form-urlencoded'.</message> </error> So I want to check what the "real" content is that is being sent to the server. By real content I mean the exact HTTP request. Any ideas how I can see this? Edit: Based on the first answers here I should clarify my problem: I want to avoid using an external program like HTTP sniffer or anything and I was hoping