File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
actionpack/lib/action_dispatch/http Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -355,16 +355,17 @@ def write(string)
355
355
356
356
# Allows you to manually set or override the response body.
357
357
def body = ( body )
358
- if body . is_a? ( String )
359
- @stream = build_buffer ( self , [ body ] )
360
- elsif body . respond_to? ( :to_path )
361
- @stream = body
362
- elsif body . respond_to? ( :to_ary )
363
- synchronize do
358
+ # Prevent ActionController::Metal::Live::Response from committing the response prematurely.
359
+ synchronize do
360
+ if body . respond_to? ( :to_str )
361
+ @stream = build_buffer ( self , [ body ] )
362
+ elsif body . respond_to? ( :to_path )
363
+ @stream = body
364
+ elsif body . respond_to? ( :to_ary )
364
365
@stream = build_buffer ( self , body )
366
+ else
367
+ @stream = body
365
368
end
366
- else
367
- @stream = body
368
369
end
369
370
end
370
371
You can’t perform that action at this time.
0 commit comments