You are here

protected function RestRegisterUserTest::createRequestOptions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Functional/RestRegisterUserTest.php \Drupal\Tests\user\Functional\RestRegisterUserTest::createRequestOptions()

Helper function to generate the request body.

Parameters

array $request_body: The request body array.

Return value

array Return the request options.

1 call to RestRegisterUserTest::createRequestOptions()
RestRegisterUserTest::registerRequest in core/modules/user/tests/src/Functional/RestRegisterUserTest.php
Make a REST user registration request.

File

core/modules/user/tests/src/Functional/RestRegisterUserTest.php, line 187

Class

RestRegisterUserTest
Tests user registration via REST resource.

Namespace

Drupal\Tests\user\Functional

Code

protected function createRequestOptions(array $request_body) {
  $request_options = $this
    ->getAuthenticationRequestOptions('POST');
  $request_options[RequestOptions::BODY] = $this->serializer
    ->encode($request_body, static::$format);
  $request_options[RequestOptions::HEADERS]['Content-Type'] = static::$mimeType;
  return $request_options;
}