You are here

public function BrowserKitDriver::setRequestHeader in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php \Behat\Mink\Driver\BrowserKitDriver::setRequestHeader()

Sets specific request header on client.

Parameters

string $name:

string $value:

Throws

UnsupportedDriverActionException When operation not supported by the driver

DriverException When the operation cannot be done

Overrides CoreDriver::setRequestHeader

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 207

Class

BrowserKitDriver
Symfony2 BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

public function setRequestHeader($name, $value) {
  $contentHeaders = array(
    'CONTENT_LENGTH' => true,
    'CONTENT_MD5' => true,
    'CONTENT_TYPE' => true,
  );
  $name = str_replace('-', '_', strtoupper($name));

  // CONTENT_* are not prefixed with HTTP_ in PHP when building $_SERVER
  if (!isset($contentHeaders[$name])) {
    $name = 'HTTP_' . $name;
  }
  $this->serverParameters[$name] = $value;
}