Skip to content

Commit

Permalink
Do not clear HTTP_COOKIES header after request
Browse files Browse the repository at this point in the history
  • Loading branch information
maclover7 committed Dec 11, 2016
1 parent 7e9ae61 commit 78c6c4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 0 additions & 2 deletions actionpack/lib/action_controller/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions actionpack/test/dispatch/cookies_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ def string_key_mock
def noop
head :ok
end

def encrypted_cookie
cookies.encrypted["foo"]
end
end

tests TestController
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 78c6c4b

Please sign in to comment.