This is the test case to show the problem, most of it is copied from WebResponseDataTest:
@Test public void testWebResponse() throws Exception { final InputStream stream = getClass().getClassLoader().getResourceAsStream("testfiles/test.html.brotli"); final byte[] zippedContent = IOUtils.toByteArray(stream); final List<com.gargoylesoftware.htmlunit.util.NameValuePair> headers = new ArrayList<>(); headers.add(new com.gargoylesoftware.htmlunit.util.NameValuePair("Content-Encoding", "br")); final WebResponseData data = new WebResponseData(zippedContent, HttpStatus.SC_OK, "OK", headers); WebResponse response=new WebResponse(data,new URL("http://test.com"),HttpMethod.GET,1000); logger.info("content string:{}", response.getContentAsString()); logger.info("body:{}", new String(data.getBody(), UTF_8)); }
Just compare the output of the last 2 lines.