instance method
cookies
Ruby on Rails 7.2.3
Since v3.0.20Signature
cookies()
Returns the response cookies, converted to a Hash of (name => value) pairs
assert_equal 'AuthorOfNewPage', r.cookies['author']
Source
# File actionpack/lib/action_dispatch/http/response.rb, line 433
def cookies
cookies = {}
if header = get_header(SET_COOKIE)
header = header.split("\n") if header.respond_to?(:to_str)
header.each do |cookie|
if pair = cookie.split(";").first
key, value = pair.split("=").map { |v| Rack::Utils.unescape(v) }
cookies[key] = value
end
end
end
cookies
end
Defined in actionpack/lib/action_dispatch/http/response.rb line 433
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Response