Browse Source

Add a unit test for Issue #2004

yhirose 1 year ago
parent
commit
e6d71bd702
1 changed files with 12 additions and 0 deletions
  1. 12 0
      test/test.cc

+ 12 - 0
test/test.cc

@@ -6132,6 +6132,18 @@ TEST(SSLClientTest, WildcardHostNameMatch_Online) {
   ASSERT_EQ(StatusCode::OK_200, res->status);
   ASSERT_EQ(StatusCode::OK_200, res->status);
 }
 }
 
 
+TEST(SSLClientTest, Issue2004) {
+  Client client("https://google.com");
+  client.set_follow_location(true);
+
+  auto res = client.Get("/");
+  ASSERT_TRUE(res);
+  ASSERT_EQ(StatusCode::OK_200, res->status);
+
+  auto body = res->body;
+  EXPECT_EQ(body.substr(0, 15), "<!doctype html>");
+}
+
 #if 0
 #if 0
 TEST(SSLClientTest, SetInterfaceWithINET6) {
 TEST(SSLClientTest, SetInterfaceWithINET6) {
   auto cli = std::make_shared<httplib::Client>("https://httpbin.org");
   auto cli = std::make_shared<httplib::Client>("https://httpbin.org");