|
|
@@ -470,6 +470,10 @@ protected:
|
|
|
EXPECT_EQ("value2", req.get_param_value("array", 1));
|
|
|
EXPECT_EQ("value3", req.get_param_value("array", 2));
|
|
|
})
|
|
|
+ .Post("/validate-no-multiple-headers", [&](const Request& req, Response& res) {
|
|
|
+ EXPECT_EQ(1u, req.get_header_value_count("Content-Length"));
|
|
|
+ EXPECT_EQ("5", req.get_header_value("Content-Length"));
|
|
|
+ })
|
|
|
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
|
|
.Get("/gzip", [&](const Request& /*req*/, Response& res) {
|
|
|
res.set_content("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "text/plain");
|
|
|
@@ -989,6 +993,15 @@ TEST_F(ServerTest, ArrayParam)
|
|
|
EXPECT_EQ(200, res->status);
|
|
|
}
|
|
|
|
|
|
+TEST_F(ServerTest, NoMultipleHeaders)
|
|
|
+{
|
|
|
+ Headers headers;
|
|
|
+ headers.emplace("Content-Length", "5");
|
|
|
+ auto res = cli_.Post("/validate-no-multiple-headers", headers, "hello", "text/plain");
|
|
|
+ ASSERT_TRUE(res != nullptr);
|
|
|
+ EXPECT_EQ(200, res->status);
|
|
|
+}
|
|
|
+
|
|
|
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
|
|
TEST_F(ServerTest, Gzip)
|
|
|
{
|