mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Set session options id to nil is respected and cancels lazy loading.
This commit is contained in:
@@ -24,9 +24,9 @@ module ActionDispatch
|
||||
|
||||
def [](key)
|
||||
if key == :id
|
||||
load_session_id! unless super(:id) || has_session_id?
|
||||
load_session_id! unless key?(:id) || has_session_id?
|
||||
end
|
||||
super(key)
|
||||
super
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -44,7 +44,12 @@ class CookieStoreTest < ActionController::IntegrationTest
|
||||
session[:foo] = 'bye!' * 1024
|
||||
head :ok
|
||||
end
|
||||
|
||||
|
||||
def change_session_id
|
||||
request.session_options[:id] = nil
|
||||
get_session_id
|
||||
end
|
||||
|
||||
def rescue_action(e) raise end
|
||||
end
|
||||
|
||||
@@ -212,6 +217,19 @@ class CookieStoreTest < ActionController::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
def test_setting_session_id_to_nil_is_respected
|
||||
with_test_route_set do
|
||||
cookies[SessionKey] = SignedBar
|
||||
|
||||
get "/get_session_id"
|
||||
sid = response.body
|
||||
assert_equal sid.size, 36
|
||||
|
||||
get "/change_session_id"
|
||||
assert_not_equal sid, response.body
|
||||
end
|
||||
end
|
||||
|
||||
def test_session_store_with_expire_after
|
||||
with_test_route_set(:expire_after => 5.hours) do
|
||||
# First request accesses the session
|
||||
|
||||
Reference in New Issue
Block a user