From 12c0b4f8991f224212300be553114e9b11dada8e Mon Sep 17 00:00:00 2001 From: Bilal Amarni Date: Sat, 9 Feb 2013 16:48:39 +0100 Subject: [PATCH] [HttpCache] removed x-debug-token from response metadata before storing it --- src/Symfony/Component/HttpKernel/HttpCache/Store.php | 1 + .../Component/HttpKernel/Tests/HttpCache/StoreTest.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 7173f44ee3c76..8862fe28f3235 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -410,6 +410,7 @@ private function persistRequest(Request $request) */ private function persistResponse(Response $response) { + $response->headers->remove('X-Debug-Token'); $headers = $response->headers->all(); $headers['X-Status'] = array($response->getStatusCode()); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php index 12d301f387af5..20fbaa11fd4c9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php @@ -90,6 +90,15 @@ public function testSetsTheXContentDigestResponseHeaderBeforeStoring() $this->assertEquals('ena94a8fe5ccb19ba61c4c0873d391e987982fbbd3', $res['x-content-digest'][0]); } + public function testStoresWithoutXDebugToken() + { + $request = Request::create('/foo'); + $this->store->write($request, new Response('foo', 200, array('X-Debug-Token' => uniqid()))); + + $response = $this->store->lookup($request); + $this->assertFalse($response->headers->has('X-Debug-Token')); + } + public function testFindsAStoredEntryWithLookup() { $this->storeSimpleEntry();