diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-06 07:54:47 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-06 07:54:47 -0700 |
commit | 447c2cb1b0684c6efcfe1063222d537567fa1d3e (patch) | |
tree | e79b8ee41cd7e931f5778a53054353aa035c0216 | |
parent | e18ebd2e62f0878a27ac3e6c810ae533f91556fa (diff) | |
download | rails-447c2cb1b0684c6efcfe1063222d537567fa1d3e.tar.gz rails-447c2cb1b0684c6efcfe1063222d537567fa1d3e.tar.bz2 rails-447c2cb1b0684c6efcfe1063222d537567fa1d3e.zip |
add a setter for the cookie jar
-rw-r--r-- | actionpack/lib/action_controller/metal/request_forgery_protection.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/request_forgery_protection.rb b/actionpack/lib/action_controller/metal/request_forgery_protection.rb index 6a55a61abe..d21a778d8d 100644 --- a/actionpack/lib/action_controller/metal/request_forgery_protection.rb +++ b/actionpack/lib/action_controller/metal/request_forgery_protection.rb @@ -139,7 +139,7 @@ module ActionController #:nodoc: request.session = NullSessionHash.new(request.env) request.env['action_dispatch.request.flash_hash'] = nil request.env['rack.session.options'] = { skip: true } - request.env['action_dispatch.cookies'] = NullCookieJar.build(request, {}) + request.cookie_jar = NullCookieJar.build(request, {}) end protected diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index e6b799cb2f..4e3a2fb637 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -8,7 +8,12 @@ require 'active_support/json' module ActionDispatch class Request < Rack::Request def cookie_jar - env['action_dispatch.cookies'] ||= Cookies::CookieJar.build(self, cookies) + env['action_dispatch.cookies'.freeze] ||= Cookies::CookieJar.build(self, cookies) + end + + # :stopdoc: + def cookie_jar=(jar) + env['action_dispatch.cookies'.freeze] = jar end def key_generator @@ -42,6 +47,7 @@ module ActionDispatch def cookies_digest env[Cookies::COOKIES_DIGEST] end + # :startdoc: end # \Cookies are read and written through ActionController#cookies. |