Sha256: bc88e6fd19bfac3457ee185fe418d4bc44f383515aa44bf54edccdfa4913c677
Contents?: true
Size: 625 Bytes
Versions: 4
Compression:
Stored size: 625 Bytes
Contents
module Rack class Nocache def initialize(app) @app = app end def call(env) status, headers, body = @app.call(patch_request_headers(env)) [status, patch_response_headers(headers), body] end protected CACHE_BUSTER = { "Cache-Control" => "no-cache, no-store, max-age=0, must-revalidate", "Pragma" => "no-cache", "Expires" => "Fri, 29 Aug 1997 02:14:00 EST" } def patch_request_headers(env) env.reject{|k,v| k =~ /^HTTP_IF/i } end def patch_response_headers(env) env.reject{|k,v| k =~ /^ETag$/i }.merge(CACHE_BUSTER) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
alf-repl-0.16.3 | lib/alf/repl/nocache.rb |
alf-repl-0.16.2 | lib/alf/repl/nocache.rb |
alf-repl-0.16.1 | lib/alf/repl/nocache.rb |
alf-repl-0.16.0 | lib/alf/repl/nocache.rb |