Use DataDownloadResponse

1. As documented
2. No need to show this inline, downloading has security advantages

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-01-18 17:00:09 +01:00
parent 29d2ca5991
commit be3ec7ffb7
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
2 changed files with 3 additions and 7 deletions

View File

@ -445,8 +445,7 @@ class ThemingController extends Controller {
cacheBuster: ' . json_encode($cacheBusterValue). '
};
})();';
$response = new Http\DataDisplayResponse($responseJS);
$response->addHeader('Content-type', 'text/javascript');
$response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript');
$response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime()));
$response->addHeader('Pragma', 'cache');
$response->cacheFor(3600);

View File

@ -910,7 +910,6 @@ class ThemingControllerTest extends TestCase {
'background-image: url(\'./img/core/filetypes/folder.svg?v=0\');' . "}\n" .
'.icon-filetype-folder-drag-accept {' .
'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v=0\')!important;' . "}\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
$expected->cacheFor(3600);
@ -948,8 +947,7 @@ class ThemingControllerTest extends TestCase {
cacheBuster: null
};
})();';
$expected = new Http\DataDisplayResponse($expectedResponse);
$expected->addHeader("Content-type","text/javascript");
$expected = new Http\DataDownloadResponse($expectedResponse, 'javascript', 'text/javascript');
$expected->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime()));
$expected->addHeader('Pragma', 'cache');
$expected->cacheFor(3600);
@ -983,8 +981,7 @@ class ThemingControllerTest extends TestCase {
cacheBuster: null
};
})();';
$expected = new Http\DataDisplayResponse($expectedResponse);
$expected->addHeader("Content-type","text/javascript");
$expected = new Http\DataDownloadResponse($expectedResponse, 'javascript', 'text/javascript');
$expected->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime()));
$expected->addHeader('Pragma', 'cache');
$expected->cacheFor(3600);