OLD | NEW |
(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("serves and responds to cache headers", () { |
| 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 schedule(() async { |
| 32 var response = await scheduleRequest("file.txt", |
| 33 headers: {"if-none-match": etag}); |
| 34 expect(response.statusCode, equals(304)); |
| 35 expect(response.headers["etag"], equals(etag)); |
| 36 expect(response.body, equals("")); |
| 37 }); |
| 38 |
| 39 endPubServe(); |
| 40 }); |
| 41 } |
OLD | NEW |