aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorKevin Casey <kacasey@berkeley.edu>2014-02-15 13:05:00 -0800
committerKevin Casey <kacasey@berkeley.edu>2014-02-15 13:05:00 -0800
commit8508346dd06399aecd413b95da92b2d1b52f7d3c (patch)
tree686234a719e00be0c4a5ba72cca4df7ce8c8ceaf /actionpack/lib/action_controller
parent4914adc2b0f0c6338f0763e364db02dcf7d49255 (diff)
downloadrails-8508346dd06399aecd413b95da92b2d1b52f7d3c.tar.gz
rails-8508346dd06399aecd413b95da92b2d1b52f7d3c.tar.bz2
rails-8508346dd06399aecd413b95da92b2d1b52f7d3c.zip
Correct prestreaming controller response status.
if the controller action has not yet streamed any data, actions should process as normal, and errors should trigger the appropriate behavior (500, or in the case of ActionController::BadRequest, a 400 Bad Request)
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal/live.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb
index 33014b97ca..fdf4ef293d 100644
--- a/actionpack/lib/action_controller/metal/live.rb
+++ b/actionpack/lib/action_controller/metal/live.rb
@@ -205,6 +205,8 @@ module ActionController
begin
super(name)
rescue => e
+ @_response.status = 500 unless @_response.committed?
+ @_response.status = 400 if e.class == ActionController::BadRequest
begin
@_response.stream.write(ActionView::Base.streaming_completion_on_exception) if request.format == :html
@_response.stream.call_on_error