protected function CookieResourceTestTrait::getAuthenticationRequestOptions in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php \Drupal\Tests\rest\Functional\CookieResourceTestTrait::getAuthenticationRequestOptions()
- 9 core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php \Drupal\Tests\rest\Functional\CookieResourceTestTrait::getAuthenticationRequestOptions()
File
- core/
modules/ rest/ tests/ src/ Functional/ CookieResourceTestTrait.php, line 82
Class
- CookieResourceTestTrait
- Trait for ResourceTestBase subclasses testing $auth=cookie.
Namespace
Drupal\Tests\rest\FunctionalCode
protected function getAuthenticationRequestOptions($method) {
$request_options[RequestOptions::HEADERS]['Cookie'] = $this->sessionCookie;
// @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
if (!in_array($method, [
'HEAD',
'GET',
'OPTIONS',
'TRACE',
])) {
$request_options[RequestOptions::HEADERS]['X-CSRF-Token'] = $this->csrfToken;
}
return $request_options;
}