songgaoye commented on code in PR #3606:
URL: https://github.com/apache/brpc/pull/3606#discussion_r4272169763


##########
test/brpc_http_message_unittest.cpp:
##########
@@ -883,6 +883,23 @@ TEST(HttpMessageTest, http_header) {
     ASSERT_FALSE(header.GetHeader(brpc::HttpHeader::SET_COOKIE));
     ASSERT_EQ(header._first_set_cookie, nullptr);
 
+    header.SetHeader(brpc::HttpHeader::SET_COOKIE, set_cookie_value1);
+    for (int i = 0; i < 128; ++i) {
+        header.SetHeader("header" + std::to_string(i), "value");
+    }
+    value = header.GetHeader(brpc::HttpHeader::SET_COOKIE);
+    ASSERT_TRUE(value && *value == set_cookie_value1);
+
+    brpc::HttpHeader other_header;
+    other_header.SetHeader(brpc::HttpHeader::SET_COOKIE, set_cookie_value2);
+    header.Swap(other_header);
+    value = header.GetHeader(brpc::HttpHeader::SET_COOKIE);
+    ASSERT_TRUE(value && *value == set_cookie_value2);
+    value = other_header.GetHeader(brpc::HttpHeader::SET_COOKIE);
+    ASSERT_TRUE(value && *value == set_cookie_value1);
+    header.Clear();
+    ASSERT_FALSE(header.GetHeader(brpc::HttpHeader::SET_COOKIE));

Review Comment:
   Thanks for the suggestion. This is already covered by the preceding Clear()
   test in the same test case:
   
   ASSERT_EQ(header._first_set_cookie, nullptr);
   
   It directly verifies that Clear() resets the cached pointer after a
   Set-Cookie header has been added, so an additional assertion after the
   Swap() scenario would be redundant.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to