File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -337,8 +337,12 @@ if (cli.send(requests, responses)) {
337
337
338
338
``` cpp
339
339
httplib::Client cli ("yahoo.com");
340
- cli.follow_location(true);
340
+
341
341
auto res = cli.Get("/");
342
+ res->status; // 301
343
+
344
+ cli.follow_location(true);
345
+ res = cli.Get("/");
342
346
res->status; // 200
343
347
```
344
348
Original file line number Diff line number Diff line change @@ -493,9 +493,14 @@ TEST(TooManyRedirectTest, Redirect) {
493
493
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
494
494
TEST (YahooRedirectTest, Redirect) {
495
495
httplib::Client cli (" yahoo.com" );
496
- cli. follow_location ( true );
496
+
497
497
auto res = cli.Get (" /" );
498
498
ASSERT_TRUE (res != nullptr );
499
+ EXPECT_EQ (301 , res->status );
500
+
501
+ cli.follow_location (true );
502
+ res = cli.Get (" /" );
503
+ ASSERT_TRUE (res != nullptr );
499
504
EXPECT_EQ (200 , res->status );
500
505
}
501
506
You can’t perform that action at this time.
0 commit comments