Skip to content

Commit 93e53c9

Browse files
committed
Updated unit test
1 parent 58cffd3 commit 93e53c9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/test.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,12 @@ TEST(NoContentTest, ContentLength) {
13251325
}
13261326

13271327
TEST(RoutingHandlerTest, PreRoutingHandler) {
1328+
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
1329+
SSLServer svr(SERVER_CERT_FILE, SERVER_PRIVATE_KEY_FILE);
1330+
ASSERT_TRUE(svr.is_valid());
1331+
#else
13281332
Server svr;
1333+
#endif
13291334

13301335
svr.set_pre_routing_handler([](const Request &req, Response &res) {
13311336
if (req.path == "/routing_handler") {
@@ -1356,7 +1361,12 @@ TEST(RoutingHandlerTest, PreRoutingHandler) {
13561361
std::this_thread::sleep_for(std::chrono::seconds(1));
13571362

13581363
{
1364+
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
1365+
SSLClient cli(HOST, PORT);
1366+
cli.enable_server_certificate_verification(false);
1367+
#else
13591368
Client cli(HOST, PORT);
1369+
#endif
13601370

13611371
auto res = cli.Get("/routing_handler");
13621372
ASSERT_TRUE(res);
@@ -1369,7 +1379,12 @@ TEST(RoutingHandlerTest, PreRoutingHandler) {
13691379
}
13701380

13711381
{
1382+
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
1383+
SSLClient cli(HOST, PORT);
1384+
cli.enable_server_certificate_verification(false);
1385+
#else
13721386
Client cli(HOST, PORT);
1387+
#endif
13731388

13741389
auto res = cli.Get("/hi");
13751390
ASSERT_TRUE(res);
@@ -1380,7 +1395,12 @@ TEST(RoutingHandlerTest, PreRoutingHandler) {
13801395
}
13811396

13821397
{
1398+
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
1399+
SSLClient cli(HOST, PORT);
1400+
cli.enable_server_certificate_verification(false);
1401+
#else
13831402
Client cli(HOST, PORT);
1403+
#endif
13841404

13851405
auto res = cli.Get("/aaa");
13861406
ASSERT_TRUE(res);

0 commit comments

Comments
 (0)