Chromium Code Reviews

Side by Side 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: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS d.file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:scheduled_test/scheduled_test.dart';
6
7 import '../descriptor.dart' as d;
8 import '../test_pub.dart';
9 import 'utils.dart';
10
11 main() {
12 integration("invalidates cache if asset changed", () {
13 d.dir(appPath, [
14 d.appPubspec(),
15 d.dir("web", [
16 d.file("file.txt", "stuff"),
17 ])
18 ]).create();
19
20 pubGet();
21 pubServe();
22
23 var etag;
24 schedule(() async {
25 var response = await scheduleRequest("file.txt");
26 expect(response.statusCode, equals(200));
27 expect(response.body, equals("stuff"));
28 etag = response.headers["etag"];
29 });
30
31 d.dir(appPath, [
32 d.dir("web", [
33 d.file("file.txt", "new stuff")
34 ])
35 ]).create();
36
37 waitForBuildSuccess();
38
39 schedule(() async {
40 var response = await scheduleRequest("file.txt",
41 headers: {"if-none-match": etag});
42 expect(response.statusCode, equals(200));
43 expect(response.body, equals("new stuff"));
44 });
45
46 endPubServe();
47 });
48 }
OLDNEW

Powered by Google App Engine