Skip to content

Commit 5317088

Browse files
committed
Update README
1 parent bfec819 commit 5317088

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,12 @@ if (cli.send(requests, responses)) {
337337

338338
```cpp
339339
httplib::Client cli("yahoo.com");
340-
cli.follow_location(true);
340+
341341
auto res = cli.Get("/");
342+
res->status; // 301
343+
344+
cli.follow_location(true);
345+
res = cli.Get("/");
342346
res->status; // 200
343347
```
344348

test/test.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,14 @@ TEST(TooManyRedirectTest, Redirect) {
493493
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
494494
TEST(YahooRedirectTest, Redirect) {
495495
httplib::Client cli("yahoo.com");
496-
cli.follow_location(true);
496+
497497
auto res = cli.Get("/");
498498
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);
499504
EXPECT_EQ(200, res->status);
500505
}
501506

0 commit comments

Comments
 (0)