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

Unified Diff: test/serve/does_not_cache_changed_asset.dart

Issue 1790503005: Provide and respect HTTP cache headers in pub serve. (Closed) Base URL: https://github.com/dart-lang/pub.git@master
Patch Set: Revise! Created 4 years, 9 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 | « test/serve/caches_unchanged_assets.dart ('k') | test/serve/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/serve/does_not_cache_changed_asset.dart
diff --git a/test/serve/does_not_cache_changed_asset.dart b/test/serve/does_not_cache_changed_asset.dart
new file mode 100644
index 0000000000000000000000000000000000000000..1d9d03f86558a2f24f3df2c9cc83acb51bd0c936
--- /dev/null
+++ b/test/serve/does_not_cache_changed_asset.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS d.file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+main() {
+ integration("invalidates cache if asset changed", () {
+ d.dir(appPath, [
+ d.appPubspec(),
+ d.dir("web", [
+ d.file("file.txt", "stuff"),
+ ])
+ ]).create();
+
+ pubGet();
+ pubServe();
+
+ var etag;
+ schedule(() async {
+ var response = await scheduleRequest("file.txt");
+ expect(response.statusCode, equals(200));
+ expect(response.body, equals("stuff"));
+ etag = response.headers["etag"];
+ });
+
+ d.dir(appPath, [
+ d.dir("web", [
+ d.file("file.txt", "new stuff")
+ ])
+ ]).create();
+
+ waitForBuildSuccess();
+
+ schedule(() async {
+ var response = await scheduleRequest("file.txt",
+ headers: {"if-none-match": etag});
+ expect(response.statusCode, equals(200));
+ expect(response.body, equals("new stuff"));
+ });
+
+ endPubServe();
+ });
+}
« no previous file with comments | « test/serve/caches_unchanged_assets.dart ('k') | test/serve/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698