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

Ensure cookie keys are strings

This commit is contained in:
Andrew White 2011-06-05 12:03:04 +01:00
parent 523c7c2330
commit 0a9270417c
2 changed files with 12 additions and 2 deletions

View file

@ -1,4 +1,5 @@
require "active_support/core_ext/object/blank"
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/hash/keys'
module ActionDispatch
class Request
@ -129,7 +130,7 @@ module ActionDispatch
end
def update(other_hash)
@cookies.update other_hash
@cookies.update other_hash.stringify_keys
self
end

View file

@ -39,6 +39,15 @@ class TestRequestTest < ActiveSupport::TestCase
req.cookie_jar["login"] = "XJ-122"
assert_cookies({"user_name" => "david", "login" => "XJ-122"}, req.cookie_jar)
req.cookie_jar.delete(:login)
assert_cookies({"user_name" => "david"}, req.cookie_jar)
req.cookie_jar.clear
assert_cookies({}, req.cookie_jar)
req.cookie_jar.update(:user_name => "david")
assert_cookies({"user_name" => "david"}, req.cookie_jar)
end
private