Skip to content

Commit

Permalink
Merge pull request #2387 from lhsoft/append_header
Browse files Browse the repository at this point in the history
use AppendHeader for http2
  • Loading branch information
Huixxi authored Oct 7, 2023
2 parents aa0f052 + 5f1b3e8 commit 3e87b91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/brpc/policy/http2_rpc_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/brpc_http_rpc_protocol_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,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");
}
Expand Down

0 comments on commit 3e87b91

Please sign in to comment.