Remove the Expires header when calling Response::expire()

This commit is contained in:
Javier Eguiluz 2018-07-27 17:20:18 +02:00
parent 2ba0fa4a14
commit ac0cd15402
2 changed files with 6 additions and 0 deletions

View File

@ -675,6 +675,7 @@ class Response
{
if ($this->isFresh()) {
$this->headers->set('Age', $this->getMaxAge());
$this->headers->remove('Expires');
}
return $this;

View File

@ -362,6 +362,11 @@ class ResponseTest extends ResponseTestCase
$response->headers->set('Expires', -1);
$response->expire();
$this->assertNull($response->headers->get('Age'), '->expire() does not set the Age when the response is expired');
$response = new Response();
$response->headers->set('Expires', date(DATE_RFC2822, time() + 600));
$response->expire();
$this->assertNull($response->headers->get('Expires'), '->expire() removes the Expires header when the response is fresh');
}
public function testGetTtl()