Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: tools/testing/dart/http_server.dart

Issue 19486005: test.py: Add 'Cache-Control' header to http responses: enable browsers to cache resources (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/http_server.dart
diff --git a/tools/testing/dart/http_server.dart b/tools/testing/dart/http_server.dart
index b222d87249bc4083b8eec01aeb3f9e47c0c0b742..720350e8d1dde1aa61df8afb19d324bf7092db38 100644
--- a/tools/testing/dart/http_server.dart
+++ b/tools/testing/dart/http_server.dart
@@ -88,6 +88,7 @@ main() {
* test framework, such as dealing with package-root.
*/
class TestingServers {
+ static final _CACHE_EXPIRATION_IN_SECONDS = 30;
static final _HARMLESS_REQUEST_PATH_ENDINGS = [
"/apple-touch-icon.png",
"/apple-touch-icon-precomposed.png",
@@ -166,6 +167,9 @@ class TestingServers {
void _handleFileOrDirectoryRequest(HttpRequest request,
HttpResponse response,
int allowedPort) {
+ // Enable browsers to cache file/directory responses.
+ response.headers.set("Cache-Control",
+ "max-age=$_CACHE_EXPIRATION_IN_SECONDS");
var path = _getFilePathFromRequestPath(request.uri.path);
if (path != null) {
var file = new File.fromPath(path);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698