Skip to content
Browse files

Ensure cookie keys are strings

  • Loading branch information...
1 parent 523c7c2 commit 0a9270417c8eb03891ec161622bcf81e5cb8af02 @pixeltrix pixeltrix committed Jun 5, 2011
View
5 actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -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 @@ def [](name)
end
def update(other_hash)
- @cookies.update other_hash
+ @cookies.update other_hash.stringify_keys
self
end
View
9 actionpack/test/dispatch/test_request_test.rb
@@ -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

0 comments on commit 0a92704

Please sign in to comment.
Something went wrong with that request. Please try again.