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:
parent
bb4a79370a
commit
964b2826c4
1 changed files with 14 additions and 0 deletions
|
@ -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)}")
|
||||
|
|
Loading…
Reference in a new issue