lib/grape/app/helpers/caching.rb in grape-app-0.8.2 vs lib/grape/app/helpers/caching.rb in grape-app-0.8.3
- old
+ new
@@ -22,10 +22,10 @@
last_modified ||= object.try(:updated_at) || object.try(:maximum, :updated_at)
etag = ActiveSupport::Digest.hexdigest(ActiveSupport::Cache.expand_cache_key(etag))
header 'ETag', etag
header 'Last-Modified', last_modified.httpdate if last_modified
- cache_control(cache_control)
+ cache_control(cache_control) unless cache_control.empty?
if_modified_since = headers['If-Modified-Since']
if_modified_since = Time.rfc2822(if_modified_since) rescue nil if if_modified_since # rubocop:disable Style/RescueModifier
if_none_match = headers['If-None-Match']
return unless if_modified_since || if_none_match