Skip to content

Commit 0bce39d

Browse files
Ensure rack.response_finished callback handles receiving arguments
Follow up to rails#55425, which was not compliant with the Rack SPEC.
1 parent f95352c commit 0bce39d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

actionpack/lib/action_dispatch/middleware/executor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def initialize(app, executor)
1313
def call(env)
1414
state = @executor.run!(reset: true)
1515
if response_finished = env["rack.response_finished"]
16-
response_finished << -> { state.complete! }
16+
response_finished << proc { state.complete! }
1717
end
1818

1919
begin

actionpack/test/dispatch/executor_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def test_complete_callbacks_are_called_on_rack_response_finished
180180
assert_not completed
181181

182182
assert_equal 1, env["rack.response_finished"].size
183-
env["rack.response_finished"].first.call
183+
env["rack.response_finished"].first.call({}, 200, {}, nil)
184184

185185
assert completed
186186
end
@@ -199,7 +199,7 @@ def test_complete_callbacks_are_called_once_on_rack_response_finished_when_excep
199199
end
200200

201201
assert_equal 1, env["rack.response_finished"].size
202-
env["rack.response_finished"].first.call
202+
env["rack.response_finished"].first.call({}, 200, {}, nil)
203203

204204
assert_equal 1, completed_count
205205
end

0 commit comments

Comments
 (0)