Class: Goliath::Rack::Cache
- Inherits:
-
Object
- Object
- Goliath::Rack::Cache
- Includes:
- AsyncMiddleware
- Defined in:
- lib/grass/goliath/rack/cache.rb
Instance Method Summary collapse
Instance Method Details
#post_process(env, status, headers, body) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/grass/goliath/rack/cache.rb', line 11 def post_process(env, status, headers, body) if body.is_a?(String) && (Grass.env == "production" || env.config['enable_cache_for_development']) # Generate ETag for body etag = etag_for(body) # Add ETag header headers['ETag'] = etag # Response with status 304 without body if env['HTTP_IF_NONE_MATCH'] == etag status = 304 body = nil end end [status,headers,body] end |