You've already forked cpp-httplib
Fixed #19
This commit is contained in:
31
test/test.cc
31
test/test.cc
@ -151,6 +151,9 @@ protected:
|
||||
svr_.get("/hi", [&](const Request& /*req*/, Response& res) {
|
||||
res.set_content("Hello World!", "text/plain");
|
||||
})
|
||||
.get("/endwith%", [&](const Request& /*req*/, Response& res) {
|
||||
res.set_content("Hello World!", "text/plain");
|
||||
})
|
||||
.get("/", [&](const Request& /*req*/, Response& res) {
|
||||
res.set_redirect("/hi");
|
||||
})
|
||||
@ -427,6 +430,34 @@ TEST_F(ServerTest, TooLongHeader)
|
||||
EXPECT_EQ(400, res->status);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, PercentEncoding)
|
||||
{
|
||||
auto res = cli_.get("/e%6edwith%");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(200, res->status);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, PercentEncodingUnicode)
|
||||
{
|
||||
auto res = cli_.get("/e%u006edwith%");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(200, res->status);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, InvalidPercentEncoding)
|
||||
{
|
||||
auto res = cli_.get("/%endwith%");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(404, res->status);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, InvalidPercentEncodingUnicode)
|
||||
{
|
||||
auto res = cli_.get("/%uendwith%");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(404, res->status);
|
||||
}
|
||||
|
||||
class ServerTestWithAI_PASSIVE : public ::testing::Test {
|
||||
protected:
|
||||
ServerTestWithAI_PASSIVE()
|
||||
|
Reference in New Issue
Block a user