jonleighton/poltergeist — pull request #358 by route (2013-07-20 12:33:11+00:00)
Title: Fix #337 ability to set header only on initial request

It's good described in #337 and I'm totally agree with that. I faced another trouble when was preparing PR, it was double firing onInitialized event.

PhantomJS has `customHeaders` property but headers will be sent to the server for every request. If we set Referer header it will appear in every subsequent ajax request. PhantomJS doesn't have any specific option to set headers just for the first request, instead they suggest a workaround, you can reset headers inside `onInitialized` callback. This commit adds second option to `driver.add_headers` method, setting this as false you can set given headers only for the first request.

/cc @jonleighton @yaauie