function RestRegisterUserTest::createRequestOptions

Same name in other branches
  1. 9 core/modules/hal/tests/src/Functional/user/RestRegisterUserTest.php \Drupal\Tests\hal\Functional\user\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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.