@@ -441,8 +441,9 @@ TEST(AbsoluteRedirectTest, Redirect) {
441
441
#endif
442
442
443
443
cli.follow_location (true );
444
- auto ret = cli.Get (" /absolute-redirect/3" );
445
- ASSERT_TRUE (ret != nullptr );
444
+ auto res = cli.Get (" /absolute-redirect/3" );
445
+ ASSERT_TRUE (res != nullptr );
446
+ EXPECT_EQ (200 , res->status );
446
447
}
447
448
448
449
TEST (RedirectTest, Redirect) {
@@ -455,8 +456,9 @@ TEST(RedirectTest, Redirect) {
455
456
#endif
456
457
457
458
cli.follow_location (true );
458
- auto ret = cli.Get (" /redirect/3" );
459
- ASSERT_TRUE (ret != nullptr );
459
+ auto res = cli.Get (" /redirect/3" );
460
+ ASSERT_TRUE (res != nullptr );
461
+ EXPECT_EQ (200 , res->status );
460
462
}
461
463
462
464
TEST (RelativeRedirectTest, Redirect) {
@@ -469,8 +471,9 @@ TEST(RelativeRedirectTest, Redirect) {
469
471
#endif
470
472
471
473
cli.follow_location (true );
472
- auto ret = cli.Get (" /relative-redirect/3" );
473
- ASSERT_TRUE (ret != nullptr );
474
+ auto res = cli.Get (" /relative-redirect/3" );
475
+ ASSERT_TRUE (res != nullptr );
476
+ EXPECT_EQ (200 , res->status );
474
477
}
475
478
476
479
TEST (TooManyRedirectTest, Redirect) {
@@ -483,23 +486,24 @@ TEST(TooManyRedirectTest, Redirect) {
483
486
#endif
484
487
485
488
cli.follow_location (true );
486
- auto ret = cli.Get (" /redirect/21" );
487
- ASSERT_TRUE (ret == nullptr );
489
+ auto res = cli.Get (" /redirect/21" );
490
+ ASSERT_TRUE (res == nullptr );
488
491
}
489
492
490
493
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
491
494
TEST (YahooRedirectTest, Redirect) {
492
495
httplib::Client cli (" yahoo.com" );
493
496
cli.follow_location (true );
494
- auto ret = cli.Get (" /" );
495
- ASSERT_TRUE (ret != nullptr );
497
+ auto res = cli.Get (" /" );
498
+ ASSERT_TRUE (res != nullptr );
499
+ EXPECT_EQ (200 , res->status );
496
500
}
497
501
498
502
TEST (Https2HttpRedirectTest, Redirect) {
499
503
httplib::SSLClient cli (" httpbin.org" );
500
504
cli.follow_location (true );
501
- auto ret = cli.Get (" /redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302" );
502
- ASSERT_TRUE (ret != nullptr );
505
+ auto res = cli.Get (" /redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302" );
506
+ ASSERT_TRUE (res != nullptr );
503
507
}
504
508
#endif
505
509
0 commit comments