class FormTestMiddleware in Drupal 9
Same name and namespace in other branches
- 8 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FormTestMiddleware:: |
protected | property | The decorated kernel. | |
FormTestMiddleware:: |
public | function | ||
FormTestMiddleware:: |
public | function | Constructs a FormTestMiddleware object. |