@@ -441,8 +441,9 @@ TEST(AbsoluteRedirectTest, Redirect) {
441441#endif
442442
443443 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 );
446447}
447448
448449TEST (RedirectTest, Redirect) {
@@ -455,8 +456,9 @@ TEST(RedirectTest, Redirect) {
455456#endif
456457
457458 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 );
460462}
461463
462464TEST (RelativeRedirectTest, Redirect) {
@@ -469,8 +471,9 @@ TEST(RelativeRedirectTest, Redirect) {
469471#endif
470472
471473 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 );
474477}
475478
476479TEST (TooManyRedirectTest, Redirect) {
@@ -483,23 +486,24 @@ TEST(TooManyRedirectTest, Redirect) {
483486#endif
484487
485488 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 );
488491}
489492
490493#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
491494TEST (YahooRedirectTest, Redirect) {
492495 httplib::Client cli (" yahoo.com" );
493496 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 );
496500}
497501
498502TEST (Https2HttpRedirectTest, Redirect) {
499503 httplib::SSLClient cli (" httpbin.org" );
500504 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 );
503507}
504508#endif
505509
0 commit comments