1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Added accessor methods for Date header

This commit is contained in:
arvida 2011-10-31 10:26:05 +01:00
parent bb4a79370a
commit 964b2826c4

View file

@ -56,6 +56,20 @@ module ActionDispatch
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)}")