mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Fix #95
This commit is contained in:
parent
9546ec842b
commit
4d7cee81eb
2 changed files with 36 additions and 12 deletions
12
test/test.cc
12
test/test.cc
|
@ -398,6 +398,10 @@ protected:
|
|||
EXPECT_EQ(0u, file.length);
|
||||
}
|
||||
})
|
||||
.Post("/empty", [&](const Request& req, Response& res) {
|
||||
EXPECT_EQ(req.body, "");
|
||||
res.set_content("empty", "text/plain");
|
||||
})
|
||||
.Put("/put", [&](const Request& req, Response& res) {
|
||||
EXPECT_EQ(req.body, "PUT");
|
||||
res.set_content(req.body, "text/plain");
|
||||
|
@ -560,6 +564,14 @@ TEST_F(ServerTest, PostMethod2)
|
|||
ASSERT_EQ("coder", res->body);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, PostEmptyContent)
|
||||
{
|
||||
auto res = cli_.Post("/empty", "", "text/plain");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
ASSERT_EQ(200, res->status);
|
||||
ASSERT_EQ("empty", res->body);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, GetMethodDir)
|
||||
{
|
||||
auto res = cli_.Get("/dir/");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue