browsermob-proxy-api
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -128,3 +128,3 @@ var http = require('http'); | ||
if(self.debug) { console.log(resp); } | ||
if(callback != undefined) { callback(resp); } | ||
if(callback != undefined) { callback(null, resp); } | ||
}); | ||
@@ -131,0 +131,0 @@ } |
{ | ||
"name": "browsermob-proxy-api", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "NodeJS bindings for controlling a browsermob-proxy instance (creating ports, HARs, etc)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,1 +13,20 @@ # Node BrowserMob Proxy API | ||
### Examples | ||
To open a port (10800) and start a new HAR: | ||
```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); | ||
}); | ||
``` |
5902
32