1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

assign the cookie hash on request allocation

this prevents mutations from being available globally
This commit is contained in:
Aaron Patterson 2015-07-08 16:27:02 -07:00
parent f65fd25f04
commit 9f09848918
2 changed files with 2 additions and 2 deletions

View file

@ -18,6 +18,7 @@ module ActionController
def self.create
env = {}
env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application
env["rack.request.cookie_hash"] = {}.with_indifferent_access
new(default_env.merge(env), new_session)
end
@ -514,7 +515,6 @@ module ActionController
end
@request = TestRequest.create
@request.env["rack.request.cookie_hash"] = {}.with_indifferent_access
@response = build_response @response_klass
@response.request = @request

View file

@ -7,12 +7,12 @@ module ActionDispatch
'HTTP_HOST' => 'test.host',
'REMOTE_ADDR' => '0.0.0.0',
'HTTP_USER_AGENT' => 'Rails Testing',
"rack.request.cookie_hash" => {}.with_indifferent_access
)
# Create a new test request with default `env` values
def self.create(env = {})
env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application
env["rack.request.cookie_hash"] ||= {}.with_indifferent_access
new(default_env.merge(env))
end