mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 09:43:51 +00:00
Update README
This commit is contained in:
parent
bfec81998b
commit
531708816a
@ -337,8 +337,12 @@ if (cli.send(requests, responses)) {
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
httplib::Client cli("yahoo.com");
|
httplib::Client cli("yahoo.com");
|
||||||
cli.follow_location(true);
|
|
||||||
auto res = cli.Get("/");
|
auto res = cli.Get("/");
|
||||||
|
res->status; // 301
|
||||||
|
|
||||||
|
cli.follow_location(true);
|
||||||
|
res = cli.Get("/");
|
||||||
res->status; // 200
|
res->status; // 200
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -493,9 +493,14 @@ TEST(TooManyRedirectTest, Redirect) {
|
|||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
TEST(YahooRedirectTest, Redirect) {
|
TEST(YahooRedirectTest, Redirect) {
|
||||||
httplib::Client cli("yahoo.com");
|
httplib::Client cli("yahoo.com");
|
||||||
cli.follow_location(true);
|
|
||||||
auto res = cli.Get("/");
|
auto res = cli.Get("/");
|
||||||
ASSERT_TRUE(res != nullptr);
|
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);
|
EXPECT_EQ(200, res->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user