You are here

protected function CsrfTest::getCurlOptions in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Tests/CsrfTest.php \Drupal\rest\Tests\CsrfTest::getCurlOptions()

Gets the cURL options to create an entity with POST.

Return value

array The array of cURL options.

2 calls to CsrfTest::getCurlOptions()
CsrfTest::testBasicAuth in core/modules/rest/src/Tests/CsrfTest.php
Tests that CSRF check is not triggered for Basic Auth requests.
CsrfTest::testCookieAuth in core/modules/rest/src/Tests/CsrfTest.php
Tests that CSRF check is triggered for Cookie Auth requests.

File

core/modules/rest/src/Tests/CsrfTest.php, line 107
Contains \Drupal\rest\Tests\CsrfTest.

Class

CsrfTest
Tests the CSRF protection.

Namespace

Drupal\rest\Tests

Code

protected function getCurlOptions() {
  return array(
    CURLOPT_HTTPGET => FALSE,
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => $this->serialized,
    CURLOPT_URL => Url::fromRoute('rest.entity.' . $this->testEntityType . '.POST')
      ->setAbsolute()
      ->toString(),
    CURLOPT_NOBODY => FALSE,
    CURLOPT_HTTPHEADER => array(
      "Content-Type: {$this->defaultMimeType}",
    ),
  );
}