How to log request/response using java.net.http.HttpClient?
You can log request and responses by specifying-Djdk.httpclient.HttpClient.log=requests on the Java command line. As for testing/mocking you might want to have a look at the offline test: http://hg.openjdk.java.net/jdk/jdk/file/tip/test/jdk/java/net/httpclient/offline/ Depending on what you are looking to achieve you could use a “DelegatingHttpClient” to intercept and log requests and responses too. Besides the Java API documentation there’s … Read more