diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-29 19:46:36 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-29 21:43:06 -0700 |
commit | 619e7c8db8b2339eae8f1f51eb2c1173808039cd (patch) | |
tree | 46a8de4350d0ecb8fa6576576d96e3edf0078717 | |
parent | 08b107e3459425e5fa40efe44638272639f11c5e (diff) | |
download | rails-619e7c8db8b2339eae8f1f51eb2c1173808039cd.tar.gz rails-619e7c8db8b2339eae8f1f51eb2c1173808039cd.tar.bz2 rails-619e7c8db8b2339eae8f1f51eb2c1173808039cd.zip |
make sure set_response! sets the correct response object
-rw-r--r-- | actionpack/lib/action_controller/metal/live.rb | 9 | ||||
-rw-r--r-- | actionpack/test/controller/live_stream_test.rb | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb index e98ad7e2a6..d1734f2138 100644 --- a/actionpack/lib/action_controller/metal/live.rb +++ b/actionpack/lib/action_controller/metal/live.rb @@ -111,5 +111,14 @@ module ActionController # :nodoc: @_response.await_commit end + + def set_response!(request) + if request.env["HTTP_VERSION"] == "HTTP/1.0" + super + else + @_response = Live::Response.new + @_response.request = request + end + end end end diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb index 5bb37a271d..e5fb50fca4 100644 --- a/actionpack/test/controller/live_stream_test.rb +++ b/actionpack/test/controller/live_stream_test.rb @@ -53,6 +53,12 @@ module ActionController TestResponse.new end + def test_set_response! + @controller.set_response!(@request) + assert_kind_of(Live::Response, @controller.response) + assert_equal @request, @controller.response.request + end + def test_write_to_stream @controller = TestController.new get :basic_stream |