You are here

protected function WebTestBase::drupalGetXHR in SimpleTest 8.3

Requests a Drupal path or an absolute path as if it is a XMLHttpRequest.

Parameters

\Drupal\Core\Url|string $path: Drupal path or URL to request from.

array $options: Array of URL options.

array $headers: Array of headers.

Return value

string The retrieved content.

1 call to WebTestBase::drupalGetXHR()
WebTestBase::drupalGetAjax in src/WebTestBase.php
Requests a path or URL in drupal_ajax format and JSON-decodes the response.

File

src/WebTestBase.php, line 882

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function drupalGetXHR($path, array $options = [], array $headers = []) {
  $headers[] = 'X-Requested-With: XMLHttpRequest';
  return $this
    ->drupalGet($path, $options, $headers);
}