title: Browsermob proxy - how can I modify response using response_interceptor?
body: <p>I am using a python <a href="https://github.com/AutomatedTester/browsermob-proxy-py" rel="nofollow">wrapper</a> for <a href="https://github.com/lightbody/browsermob-proxy/" rel="nofollow">browsermob proxy</a>, and I need to modify the server response. But I can't figure out how I can do it. Can anybody give me a working code sample?</p>
  
  <p>The documentation says I can send a javascript code for it, but it does not work for me:</p>
  
  <pre><code>server = Server(path=SCRIPT_DIR+"/browsermob-proxy/bin/browsermob-proxy", options={"port": 8888})
  server.start()
  proxy = server.create_proxy()
  
  proxy.response_interceptor('contents.setTextContents("&lt;html&gt;&lt;body&gt;Response successfully intercepted&lt;/body&gt;&lt;/html&gt;")')
  
  fp = webdriver.FirefoxProfile()
  browser = webdriver.Firefox(firefox_profile=fp, proxy=proxy)
  browser.get("http://example.com")
  </code></pre>
  
  <p>Thanks!</p>