zzo / browsermob-node

Javascript bindings for browsermob-proxy
MIT License
81 stars 33 forks source link

can't set headers #6

Open AndrewRayCode opened 11 years ago

AndrewRayCode commented 11 years ago
proxy.start(function(err, data) {
    proxy.startHAR(data.port, 'test', function(err, resp) {
        proxy.doReq('POST', '/proxy/8080/headers', JSON.stringify({'User-Agent': 'iPhone' }), function(err, newData) {

oh boy

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 Exception [NullPointerException - "null"] thrown by event method [public com.google.sitebricks.headless.Reply net.lightbody.bmp.proxy.bricks.ProxyResource.updateHeaders(int,com.google.sitebricks.headless.Request)]

at net.lightbody.bmp.proxy.bricks.ProxyResource.updateHeaders(ProxyResource.java:149)
(See below for entire trace.)
</title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /proxy/8080/headers. Reason:
<pre>    Exception [NullPointerException - "null"] thrown by event method [public com.google.sitebricks.headless.Reply net.lightbody.bmp.proxy.bricks.ProxyResource.updateHeaders(int,com.google.sitebricks.headless.Request)]

at net.lightbody.bmp.proxy.bricks.ProxyResource.updateHeaders(ProxyResource.java:149)
(See below for entire trace.)
</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
takyam-git commented 10 years ago

try proxy.doReq('POST', '/proxy/' + data.port + '/headers', ...).