You are here

public function RemoveHttpHeadersMiddleware::handle in Remove HTTP headers 8

File

src/StackMiddleware/RemoveHttpHeadersMiddleware.php, line 48

Class

RemoveHttpHeadersMiddleware
Executes removal of HTTP response headers.

Namespace

Drupal\remove_http_headers\StackMiddleware

Code

public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
  $response = $this->httpKernel
    ->handle($request, $type, $catch);

  // Only allow removal of HTTP headers on master request.
  if ($type === static::MASTER_REQUEST) {
    $response = $this
      ->removeConfiguredHttpHeaders($response);
  }
  return $response;
}