Skip to content

Commit

Permalink
live response headers can be merged with a hash
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Aug 13, 2012
1 parent 621e079 commit 8f0541b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions actionpack/lib/action_controller/metal/live.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions actionpack/test/dispatch/live_response_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8f0541b

Please sign in to comment.