mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-16 19:20:50 +00:00
Fixed #19
This commit is contained in:
1 parent
3dded8c3e3
commit
4fb2f51766
2 files changed
+56
-24
No files matched your search
@@ -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