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:
parent
523c7c2330
commit
0a9270417c
2 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue