browsermob-proxy-api
Advanced tools
Comparing version 0.1.2 to 0.1.3
11
index.js
@@ -55,11 +55,11 @@ var http = require('http'); | ||
setHeaders: function(port, json, callback) { | ||
this.call('POST', '/proxy/' + port + '/headers', json, callback); | ||
this.call('POST', '/proxy/' + port + '/headers', json, callback, true); | ||
}, | ||
setDNSLookupOverride: function(port, json, callback) { | ||
this.call('POST', '/proxy/' + port + '/hosts', json, callback); | ||
this.call('POST', '/proxy/' + port + '/hosts', json, callback, true); | ||
}, | ||
setAuthentication: function(port, domain, json, callback) { | ||
this.call('POST', '/proxy/' + port + '/auth/basic/' + domain, json, callback); | ||
this.call('POST', '/proxy/' + port + '/auth/basic/' + domain, json, callback, true); | ||
}, | ||
@@ -108,4 +108,5 @@ | ||
call: function(method, url, data, callback) { | ||
call: function(method, url, data, callback, isJson) { | ||
var self = this; | ||
var contentType = isJson ? 'application/json' : 'application/x-www-form-urlencoded'; | ||
var options = { | ||
@@ -117,3 +118,3 @@ host: this.host, | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'Content-Type': contentType, | ||
'Content-Length': data ? data.length : 0 | ||
@@ -120,0 +121,0 @@ } |
{ | ||
"name": "browsermob-proxy-api", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "NodeJS bindings for controlling a browsermob-proxy instance (creating ports, HARs, etc)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
5990
109