diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index 6021300953..8747198bf8 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -397,22 +397,13 @@ public function testResponseFormatConfiguration() { $this->drupalGet('test/serialize/field', ['query' => ['_format' => 'json']]); $this->assertHeader('content-type', 'application/json'); $this->assertResponse(200, 'A 200 response was returned when JSON was requested.'); - $headers = $this->drupalGetHeaders(); - $this->assertEqual($headers['Content-Type'], ['application/json'], 'The header Content-type is correct.'); + // Should return a 200. $this->drupalGet('test/serialize/field', ['query' => ['_format' => 'xml']]); $this->assertHeader('content-type', 'text/xml; charset=UTF-8'); $this->assertResponse(200, 'A 200 response was returned when XML was requested'); - $headers = $this->drupalGetHeaders(); - $this->assertSame(['text/xml; charset=UTF-8'], $headers['Content-Type']); - // Should return a 406. - $this->drupalGet('test/serialize/field', ['query' => ['_format' => 'html']]); - // We want to show the first format by default, see - // \Drupal\rest\Plugin\views\style\Serializer::render. - $this->assertHeader('content-type', 'application/json'); - $this->assertResponse(200, 'A 200 response was returned when HTML was requested.'); - // Now configure no format, so all of them should be allowed. + // Now configure no format, so both serialization formats should be allowed. $this->drupalPostForm($style_options, ['style_options[formats][json]' => '0', 'style_options[formats][xml]' => '0'], t('Apply')); // Should return a 200. @@ -423,7 +414,8 @@ public function testResponseFormatConfiguration() { $this->drupalGet('test/serialize/field', ['query' => ['_format' => 'xml']]); $this->assertHeader('content-type', 'text/xml; charset=UTF-8'); $this->assertResponse(200, 'A 200 response was returned when XML was requested'); - // Should return a 406 for HTML. + + // Should return a 406 for HTML still. $this->drupalGet('test/serialize/field', ['query' => ['_format' => 'html']]); $this->assertHeader('content-type', 'text/html; charset=UTF-8'); $this->assertResponse(406, 'A 406 response was returned when HTML was requested.');