[HttpFoundation] Combine Cache-Control headers
This commit is contained in:
parent
42a41b3b45
commit
1f76a70b6f
|
@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Reference in New Issue