Commit 59469bfa authored by alexpott's avatar alexpott

Issue #2512382 by Wim Leers: Follow-up for #2407195: #attached['http_header']...

Issue #2512382 by Wim Leers: Follow-up for #2407195: #attached['http_header'] being added to Response in two places
parent 84713a36
......@@ -114,23 +114,6 @@ public function onRespond(FilterResponseEvent $event) {
// https://www.owasp.org/index.php/List_of_useful_HTTP_headers
$response->headers->set('X-Content-Type-Options', 'nosniff', FALSE);
// Attach globally-declared headers to the response object so that Symfony
// can send them for us correctly.
// @todo Remove this once drupal_process_attached() no longer calls
// _drupal_add_http_header(), which has its own static. Instead,
// _drupal_process_attached() should use
// \Symfony\Component\HttpFoundation\Response->headers->set(), which is
// already documented on the (deprecated) _drupal_process_attached() to
// become the final, intended mechanism.
$headers = drupal_get_http_header();
foreach ($headers as $name => $value) {
// Symfony special-cases the 'Status' header.
if ($name === 'status') {
$response->setStatusCode($value);
}
$response->headers->set($name, $value, FALSE);
}
// Expose the cache contexts and cache tags associated with this page in a
// X-Drupal-Cache-Contexts and X-Drupal-Cache-Tags header respectively.
if ($response instanceof CacheableResponseInterface) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment