You are here

public function FormTestMiddleware::handle in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php \Drupal\form_test\StackMiddleware\FormTestMiddleware::handle()

File

core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php, line 33

Class

FormTestMiddleware
Provides a test middleware which sets a custom response header.

Namespace

Drupal\form_test\StackMiddleware

Code

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;
}