Cache control max-age = 1 day

This commit is contained in:
Tobe O 2018-04-02 11:20:18 -04:00
parent 8c6b0283e1
commit b33cd06e70
2 changed files with 2 additions and 1 deletions

View file

@ -143,7 +143,7 @@ class ResponseCache {
var privacy = 'public';
res.headers
..['cache-control'] = '$privacy, max-age=${timeout?.inSeconds ?? 0}'
..['cache-control'] = '$privacy, max-age=${timeout?.inSeconds ?? Duration.secondsPerDay}'
..['last-modified'] = formatDateForHttp(modified);
if (timeout != null) {

View file

@ -83,6 +83,7 @@ main() async {
test('sends 304 on if-modified-since', () async {
var response = await client.get('/date.txt',
headers: {'if-modified-since': formatDateForHttp(lastModified)});
print('Response (${response.statusCode}): ${response.headers}');
expect(response.statusCode, 304);
});