diff --git a/lib/luchador/cache.lua b/lib/luchador/cache.lua index 8cadcae..c3d9516 100644 --- a/lib/luchador/cache.lua +++ b/lib/luchador/cache.lua @@ -135,9 +135,10 @@ function Cache:serve() end local locally_cached - self.response.headers = self:get_stored_headers() + self.response.headers, locally_cached = self:get_stored_headers() if self.response:check_not_modified() then + if locally_cached then self:record('local') end self:not_modified() else if not self:get_page() then diff --git a/test/integration_test.lua b/test/integration_test.lua index 51420a9..d11941e 100644 --- a/test/integration_test.lua +++ b/test/integration_test.lua @@ -126,7 +126,7 @@ test("304s if etags matches If-None-Match", function() local headers = get({["If-None-Match"] = "123"}, server_response_headers) assert_match(headers, "304 Not Modified") - assert_match(headers, "X-Cache: hit") + assert_match(headers, "X-Cache: local hit") end) test("excludes disallowed 304 headers on 304", function()