提交 78c6c4b2 编写于 作者: J Jon Moss

Do not clear HTTP_COOKIES header after request

上级 7e9ae610
......@@ -514,8 +514,6 @@ def process(action, method: "GET", params: {}, session: nil, body: nil, flash: {
@request = @controller.request
@response = @controller.response
@request.delete_header "HTTP_COOKIE"
if @request.have_cookie_jar?
unless @request.cookie_jar.committed?
@request.cookie_jar.write(@response)
......
......@@ -272,6 +272,10 @@ def string_key_mock
def noop
head :ok
end
def encrypted_cookie
cookies.encrypted["foo"]
end
end
tests TestController
......@@ -1189,6 +1193,12 @@ def test_cookies_precedence_over_request_cookies
assert_equal "david", cookies[:user_name]
end
def test_cookies_are_not_cleared
cookies.encrypted["foo"] = "bar"
get :noop
assert_equal "bar", @controller.encrypted_cookie
end
private
def assert_cookie_header(expected)
header = @response.headers["Set-Cookie"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册