mirror of https://github.com/rails/rails
Fix stream closing when sending file with `ActionController::Live` included.
Fixes #12381
This commit is contained in:
parent
cd4d931659
commit
71d19f1517
|
@ -1,3 +1,9 @@
|
|||
* Fix stream closing when sending file with `ActionController::Live` included.
|
||||
|
||||
Fixes #12381
|
||||
|
||||
*Alessandro Diaferia*
|
||||
|
||||
* Better error message for typos in assert_response argument.
|
||||
|
||||
When the response type argument to `assert_response` is not a known
|
||||
|
|
|
@ -234,7 +234,7 @@ module ActionController
|
|||
|
||||
def response_body=(body)
|
||||
super
|
||||
response.stream.close if response
|
||||
response.close if response
|
||||
end
|
||||
|
||||
def set_response!(request)
|
||||
|
|
|
@ -25,6 +25,10 @@ class SendFileController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
class SendFileWithActionControllerLive < SendFileController
|
||||
include ActionController::Live
|
||||
end
|
||||
|
||||
class SendFileTest < ActionController::TestCase
|
||||
tests SendFileController
|
||||
include TestFileUtils
|
||||
|
@ -196,4 +200,14 @@ class SendFileTest < ActionController::TestCase
|
|||
assert_equal 200, @response.status
|
||||
end
|
||||
end
|
||||
|
||||
tests SendFileWithActionControllerLive
|
||||
|
||||
def test_send_file_with_action_controller_live
|
||||
@controller = SendFileWithActionControllerLive.new
|
||||
@controller.options = { :content_type => "application/x-ruby" }
|
||||
|
||||
response = process('file')
|
||||
assert_equal 200, response.status
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue