Skip to content

Commit 4c7471f

Browse files
committed
Added etags and cache control
1 parent 42251ea commit 4c7471f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkgs/http/test/html/cache_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void main() {
3030

3131
expect(response.statusCode, 200);
3232
expect(response.reasonPhrase, 'OK');
33-
expect(response.body, parse(allOf(containsPair('numOfRequests', 2))));
33+
expect(response.body, parse(allOf(containsPair('numOfRequests', 1))));
3434
});
3535

3636
test('#send a GET Request with reload type', () async {

pkgs/http/test/stub_server.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ void hybridMain(StreamChannel<dynamic> channel) async {
1717
server.listen((request) async {
1818
var path = request.uri.path;
1919
var response = request.response;
20+
response.headers
21+
..set('Cache-Control', 'public, max-age=30, immutable')
22+
..set('etag', '312424');
2023

2124
if (path == '/error') {
2225
response
@@ -57,6 +60,7 @@ void hybridMain(StreamChannel<dynamic> channel) async {
5760
// For browser runtime testing...
5861
if (path == '/echo') {
5962
++numOfRequests;
63+
6064
response
6165
..headers.add('Access-Control-Allow-Origin', '*')
6266
..headers.add('Access-Control-Allow-Methods', 'POST, GET');

0 commit comments

Comments
 (0)