function UserRegistrationRestTest::createRequestOptions

Same name in other branches
  1. 10 core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::createRequestOptions()
  2. 11.x core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::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 UserRegistrationRestTest::createRequestOptions()
UserRegistrationRestTest::registerRequest in core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
Make a REST user registration request.

File

core/modules/user/tests/src/Functional/UserRegistrationRestTest.php, line 183

Class

UserRegistrationRestTest
Tests registration of user using REST.

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.