Commit 4417b82c authored by catch's avatar catch
Browse files

Issue #2849474 by Wim Leers:...

Issue #2849474 by Wim Leers: \Drupal\Tests\rest\Functional\CookieResourceTestTrait::initAuthentication() should use the current test format, and should not send an Accept header
parent 5b2cb036
...@@ -53,10 +53,8 @@ trait CookieResourceTestTrait { ...@@ -53,10 +53,8 @@ trait CookieResourceTestTrait {
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function initAuthentication() { protected function initAuthentication() {
// @todo Remove hardcoded use of the 'json' format, and use static::$format
// + static::$mimeType instead in https://www.drupal.org/node/2820888.
$user_login_url = Url::fromRoute('user.login.http') $user_login_url = Url::fromRoute('user.login.http')
->setRouteParameter('_format', 'json'); ->setRouteParameter('_format', static::$format);
$request_body = [ $request_body = [
'name' => $this->account->name->value, 'name' => $this->account->name->value,
...@@ -65,8 +63,7 @@ protected function initAuthentication() { ...@@ -65,8 +63,7 @@ protected function initAuthentication() {
$request_options[RequestOptions::BODY] = $this->serializer->encode($request_body, 'json'); $request_options[RequestOptions::BODY] = $this->serializer->encode($request_body, 'json');
$request_options[RequestOptions::HEADERS] = [ $request_options[RequestOptions::HEADERS] = [
'Accept' => 'application/json', 'Content-Type' => static::$mimeType,
'Content-Type' => 'application/json',
]; ];
$response = $this->request('POST', $user_login_url, $request_options); $response = $this->request('POST', $user_login_url, $request_options);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment