You are here

public function Api::vclQuery in Fastly 8.3

Wraps query method from this class.

Parameters

string $uri: The uri to use for the request, appended to the host.

array $data: (optional) Data to send with the request.

string $method: (optional) The method to use for the request, defaults to GET.

array $headers: (optional) An array of headers to send with the request.

Return value

\Psr\Http\Message\ResponseInterface Response.

Throws

\GuzzleHttp\Exception\RequestException RequestException.

1 call to Api::vclQuery()
Api::testFastlyApiConnection in src/Api.php
Function for testing Fastly API connection.

File

src/Api.php, line 590

Class

Api
Fastly API for Drupal.

Namespace

Drupal\fastly

Code

public function vclQuery($uri, array $data = [], $method = 'GET', array $headers = []) {
  if (empty($data['headers'])) {
    $data['headers'] = $headers;
    $data['headers']['Accept'] = 'application/json';
    $data['headers']['Fastly-Key'] = $this->apiKey;
  }
  if ($method == "POST" || $method == "PUT") {
    $data['form_params'] = $data;
  }
  return $this
    ->vQuery($uri, $data, $method, $headers);
}