From 4417b82c97f3d55fda46f10bd848c086c219f2e3 Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Wed, 8 Feb 2017 15:04:49 +0000
Subject: [PATCH] Issue #2849474 by Wim Leers:
 \Drupal\Tests\rest\Functional\CookieResourceTestTrait::initAuthentication()
 should use the current test format, and should not send an Accept header

---
 .../rest/tests/src/Functional/CookieResourceTestTrait.php  | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php b/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php
index 41fde93d1c75..2c3ddb2714d5 100644
--- a/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php
+++ b/core/modules/rest/tests/src/Functional/CookieResourceTestTrait.php
@@ -53,10 +53,8 @@ trait CookieResourceTestTrait {
    * {@inheritdoc}
    */
   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')
-      ->setRouteParameter('_format', 'json');
+      ->setRouteParameter('_format', static::$format);
 
     $request_body = [
       'name' => $this->account->name->value,
@@ -65,8 +63,7 @@ protected function initAuthentication() {
 
     $request_options[RequestOptions::BODY] = $this->serializer->encode($request_body, 'json');
     $request_options[RequestOptions::HEADERS] = [
-      'Accept' => 'application/json',
-      'Content-Type' => 'application/json',
+      'Content-Type' => static::$mimeType,
     ];
     $response = $this->request('POST', $user_login_url, $request_options);
 
-- 
GitLab