diff options
author | Christian Schmidt <github@chsc.dk> | 2018-06-19 00:11:25 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-06-19 00:11:25 +0300 |
commit | ab2b3f32817526e5b96f1b94e47aa51b9f4cf938 (patch) | |
tree | c00687f495f3609d09fa8098cfb77e6f77277c99 /plugins/Installation | |
parent | ec71c8e229e7e435a6583247e30a01f901ead73b (diff) |
Prevent caching of tracker in proxies (#12730)
* Prevent caching of tracker in proxies
* Also send Cache-Control with 204 responses.
Varnish default config violates the HTTP spec in this respect.
* Test Cache-Control header
* Update changelog
* Use no-store instead of no-cache
Diffstat (limited to 'plugins/Installation')
-rw-r--r-- | plugins/Installation/tests/System/APITest.php | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/plugins/Installation/tests/System/APITest.php b/plugins/Installation/tests/System/APITest.php index ddae9cdfc7..d8ae5523c8 100644 --- a/plugins/Installation/tests/System/APITest.php +++ b/plugins/Installation/tests/System/APITest.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\Installation\tests\System; use Piwik\Config; -use Piwik\Tests\Framework\Constraint\HttpResponseText; +use Piwik\Http; use Piwik\Tests\Framework\Fixture; use Piwik\Tests\Framework\TestCase\SystemTestCase; @@ -36,30 +36,29 @@ class APITest extends SystemTestCase public function test_shouldReturnHttp500_IfWrongDbInfo() { - $this->assertResponseCode(500, $this->getUrl()); + $response = $this->sendHttpRequest($this->getUrl()); + $this->assertEquals(500, $response['status']); } public function test_shouldReturnValidApiResponse_IfWrongDbInfo_formatXML() { - $http = new HttpResponseText(''); - $response = $http->getResponse($this->getUrl()); + $response = $this->sendHttpRequest($this->getUrl()); - $response = str_replace("\n", "", $response); + $data = str_replace("\n", "", $response['data']); - $this->assertStringStartsWith('<?xml version="1.0" encoding="utf-8" ?><result> <error message=', $response); - $this->assertContains('Access denied', $response); - $this->assertStringEndsWith('</result>', $response); + $this->assertStringStartsWith('<?xml version="1.0" encoding="utf-8" ?><result> <error message=', $data); + $this->assertContains('Access denied', $data); + $this->assertStringEndsWith('</result>', $data); } public function test_shouldReturnValidApiResponse_IfWrongDbInfo_formatJSON() { - $http = new HttpResponseText(''); - $response = $http->getResponse($this->getUrl() . '&format=json'); + $response = $this->sendHttpRequest($this->getUrl() . '&format=json'); - $response = str_replace("\n", "", $response); + $data = str_replace("\n", "", $response['data']); - $this->assertStringStartsWith('{"result":"error","message":"', $response); - $this->assertContains('Access denied', $response); + $this->assertStringStartsWith('{"result":"error","message":"', $data); + $this->assertContains('Access denied', $data); } private function getUrl() @@ -77,4 +76,8 @@ class APITest extends SystemTestCase return dirname(__FILE__); } -}
\ No newline at end of file + protected function sendHttpRequest($url) + { + return Http::sendHttpRequest($url, 10, null, null, 0, false, false, true); + } +} |