Add swap_body function to BinaryHttpMessage.

PiperOrigin-RevId: 475376536
diff --git a/quiche/binary_http/binary_http_message.h b/quiche/binary_http/binary_http_message.h
index 88906e7..d7da4fe 100644
--- a/quiche/binary_http/binary_http_message.h
+++ b/quiche/binary_http/binary_http_message.h
@@ -46,6 +46,8 @@
     return this;
   }
 
+  void swap_body(std::string& body) { body_.swap(body); }
+
   absl::string_view body() const { return body_; }
 
   // Returns the Binary Http formatted message.
diff --git a/quiche/binary_http/binary_http_message_test.cc b/quiche/binary_http/binary_http_message_test.cc
index c747505..3ce4b0e 100644
--- a/quiche/binary_http/binary_http_message_test.cc
+++ b/quiche/binary_http/binary_http_message_test.cc
@@ -563,4 +563,13 @@
   TestPrintTo(response);
 }
 
+TEST(BinaryHttpMessage, SwapBody) {
+  BinaryHttpRequest request({});
+  request.set_body("hello, world!");
+  std::string other = "goodbye, world!";
+  request.swap_body(other);
+  EXPECT_EQ(request.body(), "goodbye, world!");
+  EXPECT_EQ(other, "hello, world!");
+}
+
 }  // namespace quiche