It is actually not possible to add custom headers due to the restriction of Webdriver. There is a problem raised by Transporter and Selenium, please refer to this topic: https://github.com/angular/protractor/issues/740 :
The transcavator (and the webdriver that it is built on top of) is designed to test your application as a user interacting with your page, so the value of browser.get is something like "do what happens if the user opens a new tab and enter this URL" . Thus, there is no way to interact with the hood, for example, with the setting of headers, except that this is usually done for your user.
Hope this helps.
source
share