提交 a05e245c 编写于 作者: E eileencodes

Refactor cookie_jar to decouple it from request object

This change decouples `cookie_jar` allocation from the request object.
We need this for moving controller tests to integration tests so we can
access the `cookie_jar` object separately.
上级 5294bf1e
......@@ -8,7 +8,7 @@
module ActionDispatch
class Request < Rack::Request
def cookie_jar
env['action_dispatch.cookies'] ||= Cookies::CookieJar.build(self)
env['action_dispatch.cookies'] ||= Cookies::CookieJar.build(env, host, ssl?, cookies)
end
end
......@@ -228,16 +228,12 @@ def self.options_for_env(env) #:nodoc:
}
end
def self.build(request)
env = request.env
def self.build(env, host, secure, cookies)
key_generator = env[GENERATOR_KEY]
options = options_for_env env
host = request.host
secure = request.ssl?
new(key_generator, host, secure, options).tap do |hash|
hash.update(request.cookies)
hash.update(cookies)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册