From f12caf930eb375ef60b741265fb331da4d615504 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 1 Sep 2015 10:40:44 +0200 Subject: Properly return 304 The ETag set in the IF_NONE_MODIFIED header is wraped in quotes ("). However the ETag that is set in response is not (yet). Also we need to cast the ETag to a string. * Added unit test --- tests/lib/appframework/http/HttpTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/appframework/http/HttpTest.php index e9be3e73904..4bcc8305db4 100644 --- a/tests/lib/appframework/http/HttpTest.php +++ b/tests/lib/appframework/http/HttpTest.php @@ -65,6 +65,14 @@ class HttpTest extends \Test\TestCase { } + public function testQuotedEtagMatchReturnsNotModified() { + $http = new Http(array('HTTP_IF_NONE_MATCH' => '"hi"')); + + $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); + $this->assertEquals('HTTP/1.1 304 Not Modified', $header); + } + + public function testLastModifiedMatchReturnsNotModified() { $dateTime = new \DateTime(null, new \DateTimeZone('GMT')); $dateTime->setTimestamp('12'); -- cgit v1.2.3