class FormTestMiddleware
Same name in other branches
- 9 core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php \Drupal\form_test\StackMiddleware\FormTestMiddleware
- 10 core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php \Drupal\form_test\StackMiddleware\FormTestMiddleware
- 11.x core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php \Drupal\form_test\StackMiddleware\FormTestMiddleware
Provides a test middleware which sets a custom response header.
Hierarchy
- class \Drupal\form_test\StackMiddleware\FormTestMiddleware implements \Symfony\Component\HttpKernel\HttpKernelInterface
Expanded class hierarchy of FormTestMiddleware
1 string reference to 'FormTestMiddleware'
- form_test.services.yml in core/
modules/ system/ tests/ modules/ form_test/ form_test.services.yml - core/modules/system/tests/modules/form_test/form_test.services.yml
1 service uses FormTestMiddleware
- form_test.http_middleware in core/
modules/ system/ tests/ modules/ form_test/ form_test.services.yml - Drupal\form_test\StackMiddleware\FormTestMiddleware
File
-
core/
modules/ system/ tests/ modules/ form_test/ src/ StackMiddleware/ FormTestMiddleware.php, line 11
Namespace
Drupal\form_test\StackMiddlewareView source
class FormTestMiddleware implements HttpKernelInterface {
/**
* The decorated kernel.
*
* @var \Symfony\Component\HttpKernel\HttpKernelInterface
*/
protected $httpKernel;
/**
* Constructs a FormTestMiddleware object.
*
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
* The decorated kernel.
*/
public function __construct(HttpKernelInterface $http_kernel) {
$this->httpKernel = $http_kernel;
}
/**
* {@inheritdoc}
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
$response = $this->httpKernel
->handle($request, $type, $catch);
$response->headers
->set('X-Form-Test-Stack-Middleware', 'invoked');
return $response;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
FormTestMiddleware::$httpKernel | protected | property | The decorated kernel. |
FormTestMiddleware::handle | public | function | |
FormTestMiddleware::__construct | public | function | Constructs a FormTestMiddleware object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.