Permalink
Browse files

Added accessor methods for Date header

  • Loading branch information...
1 parent bb4a793 commit 964b2826c44888a310488fd3ce297b68e1dbf670 arvida committed Oct 31, 2011
Showing with 14 additions and 0 deletions.
  1. +14 −0 actionpack/lib/action_dispatch/http/cache.rb
@@ -56,6 +56,20 @@ def last_modified=(utc_time)
headers['Last-Modified'] = utc_time.httpdate
end
+ def date
+ if date_header = headers['Date']
+ Time.httpdate(date_header)
+ end
+ end
+
+ def date?
+ headers.include?('Date')
+ end
+
+ def date=(utc_time)
+ headers['Date'] = utc_time.httpdate
+ end
+
def etag=(etag)
key = ActiveSupport::Cache.expand_cache_key(etag)
@etag = self["ETag"] = %("#{Digest::MD5.hexdigest(key)}")

0 comments on commit 964b282

Please sign in to comment.