@@ -262,6 +262,10 @@ class ServerTest : public ::testing::Test {
262262 svr_.get (" /hi" , [&](const Request& /* req*/ , Response& res) {
263263 res.set_content (" Hello World!" , " text/plain" );
264264 })
265+ .get (" /slow" , [&](const Request& /* req*/ , Response& res) {
266+ msleep (3000 );
267+ res.set_content (" slow" , " text/plain" );
268+ })
265269 .get (" /remote_addr" , [&](const Request& req, Response& res) {
266270 auto remote_addr = req.headers .find (" REMOTE_ADDR" )->second ;
267271 res.set_content (remote_addr.c_str (), " text/plain" );
@@ -358,6 +362,7 @@ class ServerTest : public ::testing::Test {
358362 virtual void TearDown () {
359363 svr_.stop ();
360364 t_.join ();
365+ EXPECT_EQ (false , svr_.is_handling_requests ());
361366 }
362367
363368 map<string, string> persons_;
@@ -664,6 +669,14 @@ TEST_F(ServerTest, GetMethodRemoteAddr)
664669 EXPECT_TRUE (res->body == " ::1" || res->body == " 127.0.0.1" );
665670}
666671
672+ TEST_F (ServerTest, SlowRequest)
673+ {
674+ std::thread ([=]() { auto res = cli_.get (" /slow" ); }).detach ();
675+ std::thread ([=]() { auto res = cli_.get (" /slow" ); }).detach ();
676+ std::thread ([=]() { auto res = cli_.get (" /slow" ); }).detach ();
677+ msleep (1000 );
678+ }
679+
667680#ifdef CPPHTTPLIB_ZLIB_SUPPORT
668681TEST_F (ServerTest, Gzip)
669682{
0 commit comments