FormTestMiddleware.php in Zircon Profile 8.0
File
core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php
View source
<?php
namespace Drupal\form_test\StackMiddleware;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class FormTestMiddleware implements HttpKernelInterface {
protected $httpKernel;
public function __construct(HttpKernelInterface $http_kernel) {
$this->httpKernel = $http_kernel;
}
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;
}
}