Skip to content

Commit 2b7a968

Browse files
committed
Added a unit test for URL interface
1 parent 240cc85 commit 2b7a968

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/test.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,19 @@ TEST(YahooRedirectTest, Redirect) {
649649
EXPECT_EQ(200, res->status);
650650
}
651651

652+
TEST(YahooRedirectTestWithURL, Redirect) {
653+
auto res = httplib::url::Get("http://yahoo.com");
654+
ASSERT_TRUE(res != nullptr);
655+
EXPECT_EQ(301, res->status);
656+
657+
httplib::url::options options;
658+
options.follow_location = true;
659+
660+
res = httplib::url::Get("http://yahoo.com", options);
661+
ASSERT_TRUE(res != nullptr);
662+
EXPECT_EQ(200, res->status);
663+
}
664+
652665
TEST(HttpsToHttpRedirectTest, Redirect) {
653666
httplib::SSLClient cli("httpbin.org");
654667
cli.set_follow_location(true);

0 commit comments

Comments
 (0)