diff --git a/lib/protocol/http/headers.rb b/lib/protocol/http/headers.rb index 76dcb5a..35160aa 100644 --- a/lib/protocol/http/headers.rb +++ b/lib/protocol/http/headers.rb @@ -345,7 +345,7 @@ def merge(headers) "retry-after" => false, "server" => false, "transfer-encoding" => Header::TransferEncoding, - "user-agent" => false, + "user-agent" => Header::Split, "trailer" => Header::Trailer, # Connection handling: diff --git a/test/protocol/http/headers.rb b/test/protocol/http/headers.rb index e5bb9b2..ed8c44e 100644 --- a/test/protocol/http/headers.rb +++ b/test/protocol/http/headers.rb @@ -281,6 +281,16 @@ expect(headers["content-length"]).to be == "2" end + + it "can merge multiple user-agent headers" do + headers.merge!([ + ["user-agent", "foobar/2000"], + ["user-agent", "foobar/2001"], + ]) + + expect(headers["user-agent"]).to be == ["foobar/2000", "foobar/2001"] + expect(headers["user-agent"].to_s).to be == "foobar/2000,foobar/2001" + end end with "#trailer!" do