Skip to content

Commit

Permalink
[HttpFoundation] fixed the check of 'proxy-revalidate' in Response::m…
Browse files Browse the repository at this point in the history
…ustRevalidate()
  • Loading branch information
axiac authored and stof committed Aug 3, 2015
1 parent 6b02601 commit 6c22f0a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Response.php
Expand Up @@ -587,7 +587,7 @@ public function setPublic()
*/
public function mustRevalidate()
{
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate');
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate');
}

/**
Expand Down
16 changes: 16 additions & 0 deletions src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
Expand Up @@ -92,6 +92,22 @@ public function testMustRevalidate()
$this->assertFalse($response->mustRevalidate());
}

public function testMustRevalidateWithMustRevalidateCacheControlHeader()
{
$response = new Response();
$response->headers->set('cache-control', 'must-revalidate');

$this->assertTrue($response->mustRevalidate());
}

public function testMustRevalidateWithProxyRevalidateCacheControlHeader()
{
$response = new Response();
$response->headers->set('cache-control', 'proxy-revalidate');

$this->assertTrue($response->mustRevalidate());
}

public function testSetNotModified()
{
$response = new Response();
Expand Down

0 comments on commit 6c22f0a

Please sign in to comment.