You are here

protected function RemoveHttpHeadersMiddleware::removeConfiguredHttpHeaders in Remove HTTP headers 8

Remove configured HTTP headers.

Parameters

\Symfony\Component\HttpFoundation\Response $response: The response object.

Return value

\Symfony\Component\HttpFoundation\Response The given response object without the HTTP response headers that should be removed.

1 call to RemoveHttpHeadersMiddleware::removeConfiguredHttpHeaders()
RemoveHttpHeadersMiddleware::handle in src/StackMiddleware/RemoveHttpHeadersMiddleware.php
Handles a Request to convert it to a Response.

File

src/StackMiddleware/RemoveHttpHeadersMiddleware.php, line 69

Class

RemoveHttpHeadersMiddleware
Executes removal of HTTP response headers.

Namespace

Drupal\remove_http_headers\StackMiddleware

Code

protected function removeConfiguredHttpHeaders(Response $response) : Response {
  $headersToRemove = $this->configManager
    ->getHeadersToRemove();
  foreach ($headersToRemove as $httpHeaderToRemove) {
    $response->headers
      ->remove($httpHeaderToRemove);
  }
  return $response;
}