server: fix cache bust

This commit is contained in:
0x1eef 2023-07-09 02:16:55 -03:00
parent e81d3c0324
commit 8800e7a060

View file

@ -8,12 +8,10 @@ class Server::ETag < Rack::ETag
end
def call(env)
h = ETAGS[env["REQUEST_PATH"]] || {}
if h["etag"] && h["etag"] == env["HTTP_IF_NONE_MATCH"]
[304, h, [""]]
status, headers, body = super(env)
if headers["etag"] && headers["etag"] == env["HTTP_IF_NONE_MATCH"]
[304, headers, [""]]
else
status, headers, body = super(env)
ETAGS[env["REQUEST_PATH"]] = headers
[status, headers, body]
end
end