You are here

protected function LagoonVarnishPurger::getHeaders in Lagoon Varnish 8

Retrieve all configured headers that need to be set.

Parameters

$token_data: An array of keyed objects, to pass on to the token service.

Return value

string[] Associative array with header values and field names in the key.

File

src/Plugin/Purge/Purger/LagoonVarnishPurger.php, line 95

Class

LagoonVarnishPurger
HTTP Purger.

Namespace

Drupal\lagoon_varnish\Plugin\Purge\Purger

Code

protected function getHeaders($token_data) {
  $headers = [];
  $headers['user-agent'] = 'varnish_purger module for Drupal 8.';
  foreach (self::LAGOON_VARNISH_REQUEST_HEADERS as $field => $value) {
    $headers[strtolower($field)] = $this->token
      ->replace($value, $token_data);
  }
  return $headers;
}