diff --git a/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php b/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php index d42e6b1..f8ca60b 100644 --- a/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php +++ b/core/modules/aggregator/tests/modules/aggregator_test/lib/Drupal/aggregator_test/Controller/AggregatorTestRssController.php @@ -28,6 +28,8 @@ public static function create(ContainerInterface $container) { * Set TRUE to send an etag. */ public function feed($use_last_modified = FALSE, $use_etag = FALSE, Request $request) { + $response = new Response(); + $last_modified = strtotime('Sun, 19 Nov 1978 05:00:00 GMT'); $etag = Crypt::hashBase64($last_modified); @@ -37,21 +39,21 @@ public function feed($use_last_modified = FALSE, $use_etag = FALSE, Request $req // Send appropriate response. We respond with a 304 not modified on either // etag or on last modified. if ($use_last_modified) { - drupal_add_http_header('Last-Modified', gmdate(DATE_RFC1123, $last_modified)); + $response->headers->set('Last-Modified', gmdate(DATE_RFC1123, $last_modified)); } if ($use_etag) { - drupal_add_http_header('ETag', $etag); + $response->headers->set('ETag', $etag); } // Return 304 not modified if either last modified or etag match. if ($last_modified == $if_modified_since || $etag == $if_none_match) { - drupal_add_http_header('Status', '304 Not Modified'); + $response->setStatusCode(304); return; } // The following headers force validation of cache: - drupal_add_http_header('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT'); - drupal_add_http_header('Cache-Control', 'must-revalidate'); - drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8'); + $response->headers->set('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT'); + $response->headers->set('Cache-Control', 'must-revalidate'); + $response->headers->set('Content-Type', 'application/rss+xml; charset=utf-8'); // Read actual feed from file. $file_name = drupal_get_path('module', 'aggregator_test') . '/aggregator_test_rss091.xml'; @@ -59,8 +61,8 @@ public function feed($use_last_modified = FALSE, $use_etag = FALSE, Request $req $feed = fread($handle, filesize($file_name)); fclose($handle); - return new Response($feed); - + $response->setContent($feed); + return $response; } public function redirect() {