Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Sep 6, 2019
1 parent bfec819 commit 5317088
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,12 @@ if (cli.send(requests, responses)) {

```cpp
httplib::Client cli("yahoo.com");
cli.follow_location(true);

auto res = cli.Get("/");
res->status; // 301

cli.follow_location(true);
res = cli.Get("/");
res->status; // 200
```
Expand Down
7 changes: 6 additions & 1 deletion test/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,14 @@ TEST(TooManyRedirectTest, Redirect) {
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
TEST(YahooRedirectTest, Redirect) {
httplib::Client cli("yahoo.com");
cli.follow_location(true);

auto res = cli.Get("/");
ASSERT_TRUE(res != nullptr);
EXPECT_EQ(301, res->status);

cli.follow_location(true);
res = cli.Get("/");
ASSERT_TRUE(res != nullptr);
EXPECT_EQ(200, res->status);
}

Expand Down

0 comments on commit 5317088

Please sign in to comment.