Class: Rack::Jasmine::CacheControl

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/jasmine/cache_control.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ CacheControl

Returns a new instance of CacheControl.



5
6
7
# File 'lib/rack/jasmine/cache_control.rb', line 5

def initialize(app)
  @app, @content_type = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/rack/jasmine/cache_control.rb', line 9

def call(env)
  status, headers, body = @app.call(env)
  headers = Rack::Utils::HeaderHash.new(headers)
  headers['Cache-Control'] ||= "max-age=0, private, must-revalidate"
  headers['Pragma'] ||= "no-cache"
  [status, headers, body]
end