diff --git a/src/brpc/policy/http2_rpc_protocol.cpp b/src/brpc/policy/http2_rpc_protocol.cpp index ab14863c1f..c9718f4cb4 100644 --- a/src/brpc/policy/http2_rpc_protocol.cpp +++ b/src/brpc/policy/http2_rpc_protocol.cpp @@ -1281,8 +1281,7 @@ int H2StreamContext::ConsumeHeaders(butil::IOBufBytesIterator& it) { strcmp(name + 1, /*c*/"ontent-type") == 0) { h.set_content_type(pair.value); } else { - // TODO: AppendHeader? - h.SetHeader(pair.name, pair.value); + h.AppendHeader(pair.name, pair.value); } if (FLAGS_http_verbose) { diff --git a/test/brpc_http_rpc_protocol_unittest.cpp b/test/brpc_http_rpc_protocol_unittest.cpp index 0698651e31..a201d923c0 100644 --- a/test/brpc_http_rpc_protocol_unittest.cpp +++ b/test/brpc_http_rpc_protocol_unittest.cpp @@ -1544,7 +1544,7 @@ TEST_F(HttpTest, http2_header_after_data) { ASSERT_EQ(res_header.content_type(), "application/proto"); // Check overlapped header is overwritten by the latter. const std::string* user_defined1 = res_header.GetHeader("user-defined1"); - ASSERT_EQ(*user_defined1, "overwrite-a"); + ASSERT_EQ(*user_defined1, "a,overwrite-a"); const std::string* user_defined2 = res_header.GetHeader("user-defined2"); ASSERT_EQ(*user_defined2, "b"); }