diff --git a/.idea/runConfigurations/main_dart.xml b/.idea/runConfigurations/main_dart.xml new file mode 100644 index 00000000..750f7262 --- /dev/null +++ b/.idea/runConfigurations/main_dart.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/example/main.dart b/example/main.dart index f40642ee..bdf8c5a6 100644 --- a/example/main.dart +++ b/example/main.dart @@ -3,7 +3,7 @@ import 'package:angel_framework/angel_framework.dart'; import 'package:glob/glob.dart'; main() async { - var app = new Angel(); + var app = new Angel()..lazyParseBodies = true; // Cache a glob var cache = new ResponseCache() diff --git a/lib/src/cache.dart b/lib/src/cache.dart index 5688a84a..d048c67e 100644 --- a/lib/src/cache.dart +++ b/lib/src/cache.dart @@ -67,6 +67,7 @@ class ResponseCache { Future handleRequest(RequestContext req, ResponseContext res) async { if (!await ifModifiedSince(req, res)) return false; if (req.method != 'GET' && req.method != 'HEAD') return true; + if (!res.isOpen) return true; // Check if there is a cache entry. // @@ -130,7 +131,7 @@ class ResponseCache { new Map.from(res.headers), res.buffer.toBytes(), now); }); - _setCachedHeaders(now, req, res); + // _setCachedHeaders(now, req, res); } }