lightbody/browsermob-proxy — pull request #61 by eplusx (2014-02-10 16:31:04+00:00)
Title: Support a parameter pageRef in getHar(). Also available in REST API.

Hi Patrick,

After some exploration I found it's not very difficult to incorporate the change to filter /proxy/:port/har results by pageRefs, so I prototyped an implementation. I can't really imagine how this would benefit for usual browser testing scenarios but I'm sure this is critical for long-running applications as I described in the mailing list.

I'm a newbie to Maven, so I may make dumb mistakes, but I confirmed this works as long as I checked in this way:

mvn compile
mvn exec:java &
curl -X POST -d "port=9091" http://127.0.0.1:8080/proxy
curl -X PUT -d 'captureContent=true&initialPageRef=1' http://127.0.0.1:8080/proxy/9091/har
# Make some request using 127.0.0.1:9091...
curl -X PUT -d 'pageRef=2' http://127.0.0.1:8080/proxy/9091/har/pageRef
# Make some request using 127.0.0.1:9091...
curl -X GET http://127.0.0.1:8080/proxy/9091/har # This should show both page 1 and 2
curl -X GET http://127.0.0.1:8080/proxy/9091/har?pageRef=1 # This should show only page 1
# ...
mvn -Prelease install -DskipTests=true

I skipped tests when installing because some tests hanged or failed. (Also saw this when `mvn test`.)

If you think this change is good, could you review this and let me know your thoughts? Also, I have another change for deleting existing pages, which I'll send a pull request shortly.

Thank you,
Hiroaki