diff options
author | eileencodes <eileencodes@gmail.com> | 2015-07-07 14:36:50 -0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-07-07 14:31:34 -0700 |
commit | 8363b879fe759f0645179f4521cc64795efbee6e (patch) | |
tree | 6450bbea30d76265236a1befdce5ca2b5372289e /actionpack/lib/action_controller | |
parent | ae29142142324545a328948e059e8b8118fd7a33 (diff) | |
download | rails-8363b879fe759f0645179f4521cc64795efbee6e.tar.gz rails-8363b879fe759f0645179f4521cc64795efbee6e.tar.bz2 rails-8363b879fe759f0645179f4521cc64795efbee6e.zip |
pass cookies from the jar in the HTTP_COOKIE header
we should be pushing the cookies in via headers rather than maintaining
some object and "recycling" it.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 528c5ee1d1..9a7da54c95 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -65,14 +65,6 @@ module ActionController @method = @request_method = nil @fullpath = @ip = @remote_ip = @protocol = nil @env['action_dispatch.request.query_parameters'] = {} - @set_cookies ||= {} - @set_cookies.update(Hash[cookie_jar.instance_variable_get("@set_cookies").map{ |k,o| [k,o[:value]] }]) - deleted_cookies = cookie_jar.instance_variable_get("@delete_cookies") - @set_cookies.reject!{ |k,v| deleted_cookies.include?(k) } - cookie_jar.update(rack_cookies) - cookie_jar.update(cookies) - cookie_jar.update(@set_cookies) - cookie_jar.recycle! end private @@ -453,6 +445,10 @@ module ActionController @controller.extend(Testing::Functional) end + self.cookies.update @request.cookies + @request.env['HTTP_COOKIE'] = cookies.to_header + @request.env['action_dispatch.cookies'] = nil + @request.recycle! @response.recycle! @controller.recycle! @@ -481,6 +477,8 @@ module ActionController @controller.recycle! @controller.process(action) + @request.env.delete 'HTTP_COOKIE' + if cookies = @request.env['action_dispatch.cookies'] unless @response.committed? cookies.write(@response) @@ -522,6 +520,7 @@ module ActionController end @request = build_request + @request.env["rack.request.cookie_hash"] = {}.with_indifferent_access @response = build_response response_klass @response.request = @request |