summaryrefslogtreecommitdiffstats
path: root/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php')
-rw-r--r--core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
index 055123b..abd9022 100644
--- a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
+++ b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
@@ -8,6 +8,7 @@
namespace Drupal\system_test\Controller;
use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Cache\CacheableResponse;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Render\Markup;
@@ -259,14 +260,29 @@ class SystemTestController extends ControllerBase {
*/
public function setHeader(Request $request) {
$query = $request->query->all();
- $response = new Response();
+ $response = new CacheableResponse();
$response->headers->set($query['name'], $query['value']);
+ $response->getCacheableMetadata()->addCacheContexts(['url.query_args:name', 'url.query_args:value']);
$response->setContent($this->t('The following header was set: %name: %value', array('%name' => $query['name'], '%value' => $query['value'])));
return $response;
}
/**
+ * A simple page callback that uses a plain Symfony response object.
+ */
+ public function respondWithReponse(Request $request) {
+ return new Response('test');
+ }
+
+ /**
+ * A simple page callback that uses a CacheableResponse object.
+ */
+ public function respondWithCacheableReponse(Request $request) {
+ return new CacheableResponse('test');
+ }
+
+ /**
* A simple page callback which adds a register shutdown function.
*/
public function shutdownFunctions($arg1, $arg2) {