From 46c4e9006a5cb43845367e6a7309c28ad1444326 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 1 Apr 2018 21:40:08 -0400 Subject: [PATCH] Save responses to cache --- lib/src/cache.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/cache.dart b/lib/src/cache.dart index 1124437a..32d240cb 100644 --- a/lib/src/cache.dart +++ b/lib/src/cache.dart @@ -65,7 +65,12 @@ class ResponseCache { // If the cache entry should be invalidated, then invalidate it. invalidate(req.uri.path); } + + // Save the response. + _cache[req.uri.path] = new _CachedResponse(res.headers, res.buffer.toBytes(), now); } + + return true; } } @@ -89,5 +94,5 @@ class _CachedResponse { final List body; final DateTime timestamp; - _CachedResponse({this.headers, this.body, this.timestamp}); + _CachedResponse(this.headers, this.body, this.timestamp); }