提交 4cf449df 编写于 作者: A Aaron Patterson

don't mutate a response object after to_a

When the response object is `to_a`'d, that means it's been written to
the socket.  It doesn't make sense to mutate the response object after
it's been written (and this may raise an exception in the future).
上级 f860ab3f
......@@ -150,6 +150,8 @@ def test_only_set_charset_still_defaults_to_text_html
assert_equal "user_name=david; path=/", headers["Set-Cookie"]
assert_equal({"user_name" => "david"}, @response.cookies)
@response = ActionDispatch::TestResponse.new
@response.set_cookie("user_name", :value => "david", :path => "/")
@response.set_cookie("login", :value => "foo&bar", :path => "/", :expires => Time.utc(2005, 10, 10,5))
status, headers, body = @response.to_a
assert_equal "user_name=david; path=/\nlogin=foo%26bar; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000", headers["Set-Cookie"]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册