addAutomaticRequestHeader() public method

Allows to add headers to be sent with every request the browser executes.
See also: Message::setHeader()
public addAutomaticRequestHeader ( string $name, array | string | DateTime $values ) : void
$name string Name of the header, for example "Location", "Content-Description" etc.
$values array | string | DateTime An array of values or a single value for the specified header field
return void
 /**
  * @test
  * @depends automaticHeadersAreSetOnEachRequest
  */
 public function automaticHeadersCanBeRemovedAgain()
 {
     $requestEngine = $this->createMock(Client\RequestEngineInterface::class);
     $requestEngine->expects($this->once())->method('sendRequest')->will($this->returnValue(new Http\Response()));
     $this->browser->setRequestEngine($requestEngine);
     $this->browser->addAutomaticRequestHeader('X-Test-Header', 'Acme');
     $this->browser->removeAutomaticRequestHeader('X-Test-Header');
     $this->browser->request('http://localhost/foo');
     $this->assertFalse($this->browser->getLastRequest()->hasHeader('X-Test-Header'));
 }