function FormTestMiddleware::handle

Same name in other branches
  1. 8.9.x core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php \Drupal\form_test\StackMiddleware\FormTestMiddleware::handle()
  2. 10 core/modules/system/tests/modules/form_test/src/StackMiddleware/FormTestMiddleware.php \Drupal\form_test\StackMiddleware\FormTestMiddleware::handle()
  3. 11.x 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 34

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 {
    $response = $this->httpKernel
        ->handle($request, $type, $catch);
    $response->headers
        ->set('X-Form-Test-Stack-Middleware', 'invoked');
    return $response;
}

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