Post Parameter List Only Contains The Last Parameter
I am trying to read the post parameters, but I noticed the params list size is always one and it is always the last parameter. The rest are missing.
Here is the output from my script after attempting to login to Facebook with fake credentials. Each post call prints the url, params list size, and then loops through the params (which is always just one param):
POST from: /ajax/bz
POST size: 1
ts=1431568039195
POST from: /ajax/bz
POST size: 1
ts=1431568189543
POST from: /login.php?login_attempt=1 //this is the one I am looking at
POST size: 1
qsstamp=W1tbNSwyMCwyMywyNCwzOCw0OCw4OCw5
The actual params for /login.php?login_attempt=1:
I can reproduce with the code below. I pause the debugger before looping so I can manually enter the credentials and click Login before continuing the script to ensure login.php is executed.
Code:
private static final String URL = "https://www.facebook.com";
public static void main(String[] args) throws InterruptedException {
BrowserMobProxy server = new BrowserMobProxyServer();
server.start();
server.setHarCaptureTypes(CaptureType.getAllContentCaptureTypes());
server.newHar();
Proxy proxy = ClientUtil.createSeleniumProxy(server);
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(caps);
driver.get(URL);
// pause here and manually enter fake credentials and click Login
for(HarEntry e : server.getHar().getLog().getEntries()) {
if(e.getRequest().getMethod().equalsIgnoreCase("POST")) {
System.out.println("POST from: " + e.getRequest().getUrl());
System.out.println("POST size: " + e.getRequest().getPostData().getParams().size());
if(e.getRequest().getPostData().getParams() != null) {
for(HarPostDataParam param : e.getRequest().getPostData().getParams()) {
System.out.println(param.getName() + "=" + param.getValue());
}
}
}
}
driver.quit();
server.stop();
}
I have built from the most recent code in the repo as of now.
Thanks for finding this! I believe this should be fixed by PR #229. I ran the very helpful test code you pasted, and I was able to see all the POST parameters. Assuming the build succeeds, I'll merge.
Thanks again! I am seeing all the parameters now.
Excellent! Thank you for being BMP's manual unit test :)