diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb index d8fe43b5afcbbc7bd51c0b3b091a5a8a7e66167e..bba75b22fd3e93ecf74db89dc6c3d6c6233e9d42 100644 --- a/actionpack/lib/action_controller/metal/live.rb +++ b/actionpack/lib/action_controller/metal/live.rb @@ -72,6 +72,10 @@ def []=(k,v) super end + def merge(other) + self.class.new @response, __getobj__.merge(other) + end + def to_hash __getobj__.dup end diff --git a/actionpack/test/dispatch/live_response_test.rb b/actionpack/test/dispatch/live_response_test.rb index 87a6b1383d9b5010c2b9992aa8d20f92ed6065b0..153f58c42c0825e2b26a2a9570c5e6ba9fd7149a 100644 --- a/actionpack/test/dispatch/live_response_test.rb +++ b/actionpack/test/dispatch/live_response_test.rb @@ -8,6 +8,12 @@ def setup @response = Live::Response.new end + def test_header_merge + header = @response.header.merge('Foo' => 'Bar') + assert_kind_of(ActionController::Live::Response::Header, header) + refute_equal header, @response.header + end + def test_parallel latch = ActiveSupport::Concurrency::Latch.new