You are here

protected function FastlyBackend::fastlyRequestOpt in Acquia Purge 8

Get a Guzzle option array prepared for Fastly API calls.

Parameters

string[] $headers: Additional headers to merge into the headers option.

Return value

mixed[] Guzzle option array.

3 calls to FastlyBackend::fastlyRequestOpt()
FastlyBackend::invalidateEverything in src/AcquiaPlatformCdn/FastlyBackend.php
Invalidate all 'everything' invalidations.
FastlyBackend::invalidateTags in src/AcquiaPlatformCdn/FastlyBackend.php
Invalidate all 'tag' invalidations.
FastlyBackend::invalidateUrls in src/AcquiaPlatformCdn/FastlyBackend.php
Invalidate all 'url' invalidations.

File

src/AcquiaPlatformCdn/FastlyBackend.php, line 235

Class

FastlyBackend
Provides a Fastly backend for the Platform CDN purger.

Namespace

Drupal\acquia_purge\AcquiaPlatformCdn

Code

protected function fastlyRequestOpt(array $headers = []) {
  $opt = [
    'headers' => $headers,
    'http_errors' => FALSE,
    'connect_timeout' => self::CONNECT_TIMEOUT,
    'timeout' => self::TIMEOUT,
  ];
  $opt['headers']['Accept'] = 'application/json';
  $opt['headers']['Fastly-Key'] = $this->token;
  $opt['headers']['User-Agent'] = 'Acquia Purge';

  // Trigger the debugging middleware when Purge's debug mode is enabled.
  if ($this
    ->debugger()
    ->enabled()) {
    $opt['acquia_purge_debugger'] = $this
      ->debugger();
  }
  return $opt;
}