Make tests not require body interaction

The muitipart test interacts with some significant details of the
response class.  This was largely only done because Request lacked an
addHeader method that Request already had.

Add addHeader() method to the Request class, and adapt multipart unit
tests to use it.

Tested: Unit tests pass.  Unit test only changes.

Change-Id: Icb3b92dce6d17011ae0063a962678173b1b01a87
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/http/http_request.hpp b/http/http_request.hpp
index e375f28..7cefb7d 100644
--- a/http/http_request.hpp
+++ b/http/http_request.hpp
@@ -55,6 +55,16 @@
     Request& operator=(Request&&) = default;
     ~Request() = default;
 
+    void addHeader(std::string_view key, std::string_view value)
+    {
+        req.insert(key, value);
+    }
+
+    void addHeader(boost::beast::http::field key, std::string_view value)
+    {
+        req.insert(key, value);
+    }
+
     boost::beast::http::verb method() const
     {
         return req.method();
diff --git a/test/include/multipart_test.cpp b/test/include/multipart_test.cpp
index 38ac53d..0ac201f 100644
--- a/test/include/multipart_test.cpp
+++ b/test/include/multipart_test.cpp
@@ -3,7 +3,6 @@
 
 #include <boost/beast/http/fields.hpp>
 #include <boost/beast/http/message.hpp>
-#include <boost/beast/http/string_body.hpp>
 
 #include <memory>
 #include <string_view>
@@ -26,29 +25,30 @@
 class MultipartTest : public Test
 {
   public:
-    boost::beast::http::request<boost::beast::http::string_body> req{};
     MultipartParser parser;
     std::error_code ec;
 };
 
 TEST_F(MultipartTest, TestGoodMultipartParser)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "111111111111111111111111112222222222222222222222222222222\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "{\r\n-----------------------------d74496d66958873e123456\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test3\"\r\n\r\n"
+        "{\r\n--------d74496d6695887}\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "111111111111111111111111112222222222222222222222222222222\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "{\r\n-----------------------------d74496d66958873e123456\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test3\"\r\n\r\n"
-                 "{\r\n--------d74496d6695887}\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
+
     ParserError rc = parser.parse(reqIn);
     ASSERT_EQ(rc, ParserError::PARSER_SUCCESS);
 
@@ -72,16 +72,18 @@
 
 TEST_F(MultipartTest, TestBadMultipartParser1)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "1234567890\r\n"
+        "-----------------------------d74496d66958873e\r-\r\n";
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "1234567890\r\n"
-                 "-----------------------------d74496d66958873e\r-\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
+
     ParserError rc = parser.parse(reqIn);
 
     EXPECT_EQ(rc, ParserError::ERROR_UNEXPECTED_END_OF_INPUT);
@@ -89,16 +91,17 @@
 
 TEST_F(MultipartTest, TestBadMultipartParser2)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "abcd\r\n"
+        "-----------------------------d74496d66958873e-\r\n";
+    crow::Request reqIn(body, ec);
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "abcd\r\n"
-                 "-----------------------------d74496d66958873e-\r\n";
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
 
-    crow::Request reqIn(req, ec);
     ParserError rc = parser.parse(reqIn);
 
     EXPECT_EQ(rc, ParserError::ERROR_UNEXPECTED_END_OF_INPUT);
@@ -106,162 +109,176 @@
 
 TEST_F(MultipartTest, TestErrorBoundaryFormat)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary+=-----------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "{\"Key1\": 11223333333333333333333333333333333333333333}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "{\"Key1\": 11223333333333333333333333333333333333333333}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary+=-----------------------------d74496d66958873e");
+
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_BOUNDARY_FORMAT);
 }
 
 TEST_F(MultipartTest, TestErrorBoundaryCR)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r"
+        "{\"Key1\": 112233}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    req.body() = "-----------------------------d74496d66958873e"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r"
-                 "{\"Key1\": 112233}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
 
-    crow::Request reqIn(req, ec);
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_BOUNDARY_CR);
 }
 
 TEST_F(MultipartTest, TestErrorBoundaryLF)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "{\"Key1\": 112233}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
 
-    req.body() = "-----------------------------d74496d66958873e\r"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "{\"Key1\": 112233}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
+
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_BOUNDARY_LF);
 }
 
 TEST_F(MultipartTest, TestErrorBoundaryData)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d7449sd6d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "{\"Key1\": 112233}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "{\"Key1\": 112233}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d7449sd6d66958873e");
+
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_BOUNDARY_DATA);
 }
 
 TEST_F(MultipartTest, TestErrorEmptyHeader)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        ": form-data; name=\"Test1\"\r\n"
+        "{\"Key1\": 112233}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 ": form-data; name=\"Test1\"\r\n"
-                 "{\"Key1\": 112233}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
 
-    crow::Request reqIn(req, ec);
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_EMPTY_HEADER);
 }
 
 TEST_F(MultipartTest, TestErrorHeaderName)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-!!Disposition: form-data; name=\"Test1\"\r\n"
+        "{\"Key1\": 112233}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-!!Disposition: form-data; name=\"Test1\"\r\n"
-                 "{\"Key1\": 112233}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
 
-    crow::Request reqIn(req, ec);
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_HEADER_NAME);
 }
 
 TEST_F(MultipartTest, TestErrorHeaderValue)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r"
+        "{\"Key1\": 112233}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r"
-                 "{\"Key1\": 112233}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
+
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_HEADER_VALUE);
 }
 
 TEST_F(MultipartTest, TestErrorHeaderEnding)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r"
+        "{\"Key1\": 112233}\r\n"
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "123456\r\n"
+        "-----------------------------d74496d66958873e--\r\n";
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r"
-                 "{\"Key1\": 112233}\r\n"
-                 "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "123456\r\n"
-                 "-----------------------------d74496d66958873e--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
+
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_HEADER_ENDING);
 }
 
 TEST_F(MultipartTest, TestGoodMultipartParserMultipleHeaders)
 {
-    req.set("Content-Type",
-            "multipart/form-data; "
-            "boundary=---------------------------d74496d66958873e");
+    std::string_view body = "-----------------------------d74496d66958873e\r\n"
+                            "Content-Disposition: form-data; name=\"Test1\"\r\n"
+                            "Other-Header: value=\"v1\"\r\n"
+                            "\r\n"
+                            "Data1\r\n"
+                            "-----------------------------d74496d66958873e--";
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n"
-                 "Other-Header: value=\"v1\"\r\n"
-                 "\r\n"
-                 "Data1\r\n"
-                 "-----------------------------d74496d66958873e--";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type",
+                    "multipart/form-data; "
+                    "boundary=---------------------------d74496d66958873e");
+
     ParserError rc = parser.parse(reqIn);
     ASSERT_EQ(rc, ParserError::PARSER_SUCCESS);
 
@@ -277,32 +294,32 @@
 
 TEST_F(MultipartTest, TestErrorHeaderWithoutColon)
 {
-    req.set("Content-Type", "multipart/form-data; "
-                            "boundary=--end");
+    std::string_view body = "----end\r\n"
+                            "abc\r\n"
+                            "\r\n"
+                            "Data1\r\n"
+                            "----end--\r\n";
+    crow::Request reqIn(body, ec);
 
-    req.body() = "----end\r\n"
-                 "abc\r\n"
-                 "\r\n"
-                 "Data1\r\n"
-                 "----end--\r\n";
+    reqIn.addHeader("Content-Type", "multipart/form-data; "
+                                    "boundary=--end");
 
-    crow::Request reqIn(req, ec);
     EXPECT_EQ(parser.parse(reqIn), ParserError::ERROR_UNEXPECTED_END_OF_HEADER);
 }
 
 TEST_F(MultipartTest, TestUnknownHeaderIsCorrectlyParsed)
 {
-    req.set("Content-Type", "multipart/form-data; "
-                            "boundary=--end");
-
-    req.body() =
+    std::string_view body =
         "----end\r\n"
         "t-DiPpcccc:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccgcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaaaa\r\n"
         "\r\n"
         "Data1\r\n"
         "----end--\r\n";
 
-    crow::Request reqIn(req, ec);
+    crow::Request reqIn(body, ec);
+
+    reqIn.addHeader("Content-Type", "multipart/form-data; "
+                                    "boundary=--end");
     ParserError rc = parser.parse(reqIn);
 
     ASSERT_EQ(rc, ParserError::PARSER_SUCCESS);
@@ -318,17 +335,18 @@
 
 TEST_F(MultipartTest, TestErrorMissingSeparatorBetweenMimeFieldsAndData)
 {
-    req.set(
-        "Content-Type",
-        "multipart/form-data; boundary=---------------------------d74496d66958873e");
-
-    req.body() =
+    std::string_view body =
         "-----------------------------d74496d66958873e\r\n"
         "t-DiPpcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccgcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccaaaaaa\r\n"
         "Data1"
         "-----------------------------d74496d66958873e--";
 
-    crow::Request reqIn(req, ec);
+    crow::Request reqIn(body, ec);
+
+    reqIn.addHeader(
+        "Content-Type",
+        "multipart/form-data; boundary=---------------------------d74496d66958873e");
+
     ParserError rc = parser.parse(reqIn);
 
     EXPECT_EQ(rc, ParserError::ERROR_UNEXPECTED_END_OF_HEADER);
@@ -336,16 +354,17 @@
 
 TEST_F(MultipartTest, TestDataWithoutMimeFields)
 {
-    req.set(
+    std::string_view body = "-----------------------------d74496d66958873e\r\n"
+                            "\r\n"
+                            "Data1\r\n"
+                            "-----------------------------d74496d66958873e--";
+
+    crow::Request reqIn(body, ec);
+
+    reqIn.addHeader(
         "Content-Type",
         "multipart/form-data; boundary=---------------------------d74496d66958873e");
 
-    req.body() = "-----------------------------d74496d66958873e\r\n"
-                 "\r\n"
-                 "Data1\r\n"
-                 "-----------------------------d74496d66958873e--";
-
-    crow::Request reqIn(req, ec);
     ParserError rc = parser.parse(reqIn);
 
     ASSERT_EQ(rc, ParserError::PARSER_SUCCESS);
@@ -362,15 +381,16 @@
 
 TEST_F(MultipartTest, TestErrorMissingFinalBoundry)
 {
-    req.set("Content-Type", "multipart/form-data; boundary=--XX");
-
-    req.body() =
+    std::string_view body =
         "----XX\r\n"
         "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
         "t-DiPpccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccAAAAAAAAAAAAAAABCDz\r\n"
         "\335\r\n\r\n";
 
-    crow::Request reqIn(req, ec);
+    crow::Request reqIn(body, ec);
+
+    reqIn.addHeader("Content-Type", "multipart/form-data; boundary=--XX");
+
     ParserError rc = parser.parse(reqIn);
 
     EXPECT_EQ(rc, ParserError::ERROR_UNEXPECTED_END_OF_INPUT);
@@ -378,17 +398,19 @@
 
 TEST_F(MultipartTest, TestIgnoreDataAfterFinalBoundary)
 {
-    req.set("Content-Type", "multipart/form-data; boundary=--XX");
+    std::string_view body =
+        "----XX\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "Data1\r\n"
+        "----XX--\r\n"
+        "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
+        "Data2\r\n"
+        "----XX--\r\n";
 
-    req.body() = "----XX\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "Data1\r\n"
-                 "----XX--\r\n"
-                 "Content-Disposition: form-data; name=\"Test2\"\r\n\r\n"
-                 "Data2\r\n"
-                 "----XX--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type", "multipart/form-data; boundary=--XX");
+
     ParserError rc = parser.parse(reqIn);
 
     ASSERT_EQ(rc, ParserError::PARSER_SUCCESS);
@@ -403,16 +425,18 @@
 
 TEST_F(MultipartTest, TestFinalBoundaryIsCorrectlyRecognized)
 {
-    req.set("Content-Type", "multipart/form-data; boundary=--XX");
+    std::string_view body =
+        "----XX\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
+        "Data1\r\n"
+        "----XX-abc-\r\n"
+        "StillData1\r\n"
+        "----XX--\r\n";
 
-    req.body() = "----XX\r\n"
-                 "Content-Disposition: form-data; name=\"Test1\"\r\n\r\n"
-                 "Data1\r\n"
-                 "----XX-abc-\r\n"
-                 "StillData1\r\n"
-                 "----XX--\r\n";
+    crow::Request reqIn(body, ec);
 
-    crow::Request reqIn(req, ec);
+    reqIn.addHeader("Content-Type", "multipart/form-data; boundary=--XX");
+
     ParserError rc = parser.parse(reqIn);
 
     ASSERT_EQ(rc, ParserError::PARSER_SUCCESS);