Created
September 21, 2010 18:54
-
-
Save omarqureshi/590284 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/actionpack/lib/action_controller/session/abstract_store.rb b/actionpack/lib/action_controller/session/abstract_store.rb | |
index 51acab2..2681db6 100644 | |
--- a/actionpack/lib/action_controller/session/abstract_store.rb | |
+++ b/actionpack/lib/action_controller/session/abstract_store.rb | |
@@ -206,11 +206,8 @@ module ActionController | |
cookie << "; HttpOnly" if options[:httponly] | |
headers = response[1] | |
- unless headers[SET_COOKIE].blank? | |
- headers[SET_COOKIE] << "\n#{cookie}" | |
- else | |
- headers[SET_COOKIE] = cookie | |
- end | |
+ headers[SET_COOKIE] = [] if headers[SET_COOKIE].blank? | |
+ headers[SET_COOKIE] << cookie | |
end | |
end | |
diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb | |
index 6f2fe32..98678d7 100644 | |
--- a/actionpack/test/activerecord/active_record_store_test.rb | |
+++ b/actionpack/test/activerecord/active_record_store_test.rb | |
@@ -31,7 +31,13 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest | |
session[:foo] = "baz" | |
head :ok | |
end | |
- | |
+ | |
+ def set_session_value_and_cookie | |
+ cookies["foo"] = "bar" | |
+ session[:foo] = "bar" | |
+ render :nothing => true | |
+ end | |
+ | |
def rescue_action(e) raise end | |
end | |
@@ -194,6 +200,15 @@ class ActiveRecordStoreTest < ActionController::IntegrationTest | |
assert_equal session_id, cookies['_session_id'] | |
end | |
end | |
+ | |
+ def test_setting_session_value_and_cookie | |
+ with_test_route_set do | |
+ get '/set_session_value_and_cookie' | |
+ assert_response :success | |
+ assert !cookies["\n_session_id"] | |
+ assert_equal({"_session_id" => request.session_options[:id], "foo" => "bar"}, cookies) | |
+ end | |
+ end | |
private | |
def with_test_route_set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment