The implementation for Location.reload(
) is turning it into a Location.setHref(Location.getHref())
, which naturally means every page gets reloaded as a GET
request, making it an entirely different request.
The following isn't much thought out, but seems to fix POST
loaded pages:
public void reload(final boolean force) throws IOException { final Page page = window_.getWebWindow().getEnclosedPage(); final WebRequest request = page.getWebResponse().getWebRequest(); final WebWindow webWindow = window_.getWebWindow(); webWindow.getWebClient().download(webWindow, "", request, true, false, "JS location.reload()"); }
The link in the first paragraph is broken. Since edits are disabled, here's the url it's supposed to be:
https://sourceforge.net/p/htmlunit/code/HEAD/tree/tags/HtmlUnit-2.23/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java#l142
Now fixed in SVN. Thanks for your report and sorry for the long delay before fixing this