[HttpFoundation] Combine Cache-Control headers

This commit is contained in:
Christian Schmidt 2017-10-08 16:27:20 +02:00
parent 42a41b3b45
commit 1f76a70b6f
2 changed files with 12 additions and 1 deletions

View File

@ -146,7 +146,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
}
if ('cache-control' === $key) {
$this->cacheControl = $this->parseCacheControl($values[0]);
$this->cacheControl = $this->parseCacheControl(implode(', ', $this->headers[$key]));
}
}

View File

@ -110,6 +110,17 @@ class ResponseHeaderBagTest extends TestCase
$bag = new ResponseHeaderBag();
$bag->set('Last-Modified', 'abcde');
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
$bag = new ResponseHeaderBag();
$bag->set('Cache-Control', array('public', 'must-revalidate'));
$this->assertCount(1, $bag->get('Cache-Control', null, false));
$this->assertEquals('must-revalidate, public', $bag->get('Cache-Control'));
$bag = new ResponseHeaderBag();
$bag->set('Cache-Control', 'public');
$bag->set('Cache-Control', 'must-revalidate', false);
$this->assertCount(1, $bag->get('Cache-Control', null, false));
$this->assertEquals('must-revalidate, public', $bag->get('Cache-Control'));
}
public function testToStringIncludesCookieHeaders()