Skip to content

Commit 282f2fe

Browse files
committed
Add a unit test
1 parent 60a1f00 commit 282f2fe

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/test.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,32 @@ TEST(PathUrlEncodeTest, PathUrlEncode) {
18631863
}
18641864
}
18651865

1866+
TEST(PathUrlEncodeTest, IncludePercentEncodingLF) {
1867+
Server svr;
1868+
1869+
svr.Get("/", [](const Request &req, Response &res) {
1870+
EXPECT_EQ("\x0A", req.get_param_value("something"));
1871+
});
1872+
1873+
auto thread = std::thread([&]() { svr.listen(HOST, PORT); });
1874+
auto se = detail::scope_exit([&] {
1875+
svr.stop();
1876+
thread.join();
1877+
ASSERT_FALSE(svr.is_running());
1878+
});
1879+
1880+
svr.wait_until_ready();
1881+
1882+
{
1883+
Client cli(HOST, PORT);
1884+
cli.set_url_encode(false);
1885+
1886+
auto res = cli.Get("/?something=%0A");
1887+
ASSERT_TRUE(res);
1888+
EXPECT_EQ(StatusCode::OK_200, res->status);
1889+
}
1890+
}
1891+
18661892
TEST(BindServerTest, DISABLED_BindDualStack) {
18671893
Server svr;
18681894

0 commit comments

Comments
 (0)