Merge pull request #3000 from nextcloud/cache-no-store
set 'no-store' cache header if we do not want FF to cache
This commit is contained in:
commit
aee11009bd
|
@ -43,11 +43,11 @@ use OCP\AppFramework\Http;
|
|||
class Response {
|
||||
|
||||
/**
|
||||
* Headers - defaults to ['Cache-Control' => 'no-cache, must-revalidate']
|
||||
* Headers - defaults to ['Cache-Control' => 'no-cache, no-store, must-revalidate']
|
||||
* @var array
|
||||
*/
|
||||
private $headers = array(
|
||||
'Cache-Control' => 'no-cache, must-revalidate'
|
||||
'Cache-Control' => 'no-cache, no-store, must-revalidate'
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ class ControllerTest extends \Test\TestCase {
|
|||
public function testFormatDataResponseJSON() {
|
||||
$expectedHeaders = [
|
||||
'test' => 'something',
|
||||
'Cache-Control' => 'no-cache, must-revalidate',
|
||||
'Cache-Control' => 'no-cache, no-store, must-revalidate',
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
'Content-Security-Policy' => "default-src 'none';script-src 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self';connect-src 'self';media-src 'self'",
|
||||
];
|
||||
|
|
|
@ -67,7 +67,7 @@ class DataResponseTest extends \Test\TestCase {
|
|||
$response = new DataResponse($data, $code, $headers);
|
||||
|
||||
$expectedHeaders = [
|
||||
'Cache-Control' => 'no-cache, must-revalidate',
|
||||
'Cache-Control' => 'no-cache, no-store, must-revalidate',
|
||||
'Content-Security-Policy' => "default-src 'none';script-src 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self';connect-src 'self';media-src 'self'",
|
||||
];
|
||||
$expectedHeaders = array_merge($expectedHeaders, $headers);
|
||||
|
|
|
@ -97,7 +97,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
|
||||
public function testCacheHeadersAreDisabledByDefault(){
|
||||
$headers = $this->childResponse->getHeaders();
|
||||
$this->assertEquals('no-cache, must-revalidate', $headers['Cache-Control']);
|
||||
$this->assertEquals('no-cache, no-store, must-revalidate', $headers['Cache-Control']);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue