/**
  * @test
  * @depends automaticHeadersAreSetOnEachRequest
  */
 public function automaticHeadersCanBeRemovedAgain()
 {
     $requestEngine = $this->getMock(\TYPO3\Flow\Http\Client\RequestEngineInterface::class);
     $requestEngine->expects($this->once())->method('sendRequest')->will($this->returnValue(new 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'));
 }
 /**
  * @param string $method
  * @param \Flowpack\ElasticSearch\Domain\Model\Client $client
  * @param string $path
  * @param array $arguments
  * @param string|array $content
  *
  * @return \Flowpack\ElasticSearch\Transfer\Response
  */
 public function request($method, \Flowpack\ElasticSearch\Domain\Model\Client $client, $path = null, $arguments = array(), $content = null)
 {
     $clientConfigurations = $client->getClientConfigurations();
     $clientConfiguration = $clientConfigurations[0];
     $uri = clone $clientConfiguration->getUri();
     if ($path !== null) {
         $uri->setPath($uri->getPath() . $path);
     }
     $response = $this->browser->request($uri, $method, $arguments, array(), array(), is_array($content) ? json_encode($content) : $content);
     return new Response($response, $this->browser->getLastRequest());
 }