Skip to content

Commit

Permalink
WIP: BrowserControl debug
Browse files Browse the repository at this point in the history
use strict comes from:

HtmlUnit/htmlunit#188

but appears to go wrong in gzipped results.
  • Loading branch information
jogu committed Jun 12, 2021
1 parent f37e60c commit 491c491
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,16 @@ public WebResponse getResponse(WebRequest webRequest) throws IOException {

WebResponse response = super.getResponse(webRequest);

// if (MimeType.APPLICATION_JAVASCRIPT.equals(response.getContentType())) {
// String content = response.getContentAsString();
// content = content.replace("'use strict';", "");
// content = content.replace("\"use strict\";", "");
//
// final WebResponseData data = new WebResponseData(content.getBytes(),
// response.getStatusCode(), response.getStatusMessage(), response.getResponseHeaders());
// response = new WebResponse(data, response.getWebRequest(), response.getLoadTime());
// }
//
if (response.getStatusCode() == 302) {
eventLog.log("WebRunner", args(
"msg", "Redirect "+response.getStatusCode() + " " + response.getStatusMessage()+" to " + response.getResponseHeaderValue("location") + " from " + webRequest.getHttpMethod() + " " + webRequest.getUrl(),
Expand Down Expand Up @@ -703,6 +713,7 @@ protected WebClient modifyWebClient(WebClient client) {
client.setWebConnection(new LoggingHttpWebConnection(client));
}

//client.getOptions().setThrowExceptionOnScriptError(false);
return client;
}
}
Expand Down

0 comments on commit 491c491

Please sign in to comment.