Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make sure set_response! sets the correct response object
  • Loading branch information
tenderlove committed Jul 30, 2012
1 parent 08b107e commit 619e7c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions actionpack/lib/action_controller/metal/live.rb
Expand Up @@ -111,5 +111,14 @@ def process(name)

@_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
6 changes: 6 additions & 0 deletions actionpack/test/controller/live_stream_test.rb
Expand Up @@ -53,6 +53,12 @@ def build_response
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
Expand Down

0 comments on commit 619e7c8

Please sign in to comment.