+ if ($expected_status_code === 204) {
+ // DELETE responses should not include a Content-Type header. But Apache
+ // sets it to 'text/html' by default. We also cannot detect the presence
+ // of Apache either here in the CLI. For now having this documented here
+ // is all we can do.
+ // $this->assertSame(FALSE, $response->hasHeader('Content-Type'));
+ $this->assertSame('', (string) $response->getBody());
+ }
+ else {
+ $this->assertSame([static::$mimeType], $response->getHeader('Content-Type'));
+ if ($expected_body !== FALSE) {
+ $this->assertSame($expected_body, (string) $response->getBody());
+ }
+ }
+
+ // Expected cache tags: X-Drupal-Cache-Tags header.
+ $this->assertSame($expected_cache_tags !== FALSE, $response->hasHeader('X-Drupal-Cache-Tags'));
+ if (is_array($expected_cache_tags)) {
+ $this->assertSame($expected_cache_tags, explode(' ', $response->getHeader('X-Drupal-Cache-Tags')[0]));
+ }
+
+ // Expected cache contexts: X-Drupal-Cache-Contexts header.
+ $this->assertSame($expected_cache_contexts !== FALSE, $response->hasHeader('X-Drupal-Cache-Contexts'));
+ if (is_array($expected_cache_contexts)) {
+ $this->assertSame($expected_cache_contexts, explode(' ', $response->getHeader('X-Drupal-Cache-Contexts')[0]));
+ }
+
+ // Expected Page Cache header value: X-Drupal-Cache header.
+ if ($expected_page_cache_header_value !== FALSE) {
+ $this->assertTrue($response->hasHeader('X-Drupal-Cache'));
+ $this->assertSame($expected_page_cache_header_value, $response->getHeader('X-Drupal-Cache')[0]);
+ }
+ else {
+ $this->assertFalse($response->hasHeader('X-Drupal-Cache'));
+ }
+
+ // Expected Dynamic Page Cache header value: X-Drupal-Dynamic-Cache header.
+ if ($expected_dynamic_page_cache_header_value !== FALSE) {
+ $this->assertTrue($response->hasHeader('X-Drupal-Dynamic-Cache'));
+ $this->assertSame($expected_dynamic_page_cache_header_value, $response->getHeader('X-Drupal-Dynamic-Cache')[0]);
+ }
+ else {
+ $this->assertFalse($response->hasHeader('X-Drupal-Dynamic-Cache'));