function SystemTestController::respondWithCacheableRedirectResponse

Same name and namespace in other branches
  1. 10 core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::respondWithCacheableRedirectResponse()
  2. main core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::respondWithCacheableRedirectResponse()

Returns a CacheableRedirectResponse with the given status code.

Attributes

#[Route(path: '/system-test/redirect/cacheable/{status_code}', name: 'router_test.cacheable_redirect', requirements: [ '_access' => 'TRUE', 'status_code' => '201|301|302|303|307|308', ])]

File

core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php, line 580

Class

SystemTestController
Controller routines for system_test routes.

Namespace

Drupal\system_test\Controller

Code

public function respondWithCacheableRedirectResponse(int $status_code) : CacheableRedirectResponse {
  return new CacheableRedirectResponse('/llamas', $status_code);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.