NodeJS bindings for controlling a browsermob-proxy instance (creating ports, HARs, etc)
npm install browsermob-proxy-apiThis project provides a NodeJS interface for interacting with a running BrowserMob Proxy through it's REST API. All methods in the REST API are available including JavaScript-based interceptors for requests/responses.
Installation command is ``npm install browsermob-proxy-api`
For the specifics of the REST API used by BrowserMob Proxy, please see their documentation.
javascript
var MobProxy = require('browsermob-proxy-api');
var proxy = new MobProxy({'host':'localhost', 'port': '8080'});// start listening on port 10800:
proxy.startPort(10800, function(err, data) {
// start new HAR report
proxy.createHAR(10800, { 'initialPageRef': 'foo' });
});
`To get the current HAR from a previously opened port:
`javascript
proxy.getHAR(10800, function(err, data) {
console.log(data);
});
``