mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Added a unit test for URL interface
This commit is contained in:
parent
240cc85ccb
commit
2b7a968468
1 changed files with 13 additions and 0 deletions
13
test/test.cc
13
test/test.cc
|
@ -649,6 +649,19 @@ TEST(YahooRedirectTest, Redirect) {
|
||||||
EXPECT_EQ(200, res->status);
|
EXPECT_EQ(200, res->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YahooRedirectTestWithURL, Redirect) {
|
||||||
|
auto res = httplib::url::Get("http://yahoo.com");
|
||||||
|
ASSERT_TRUE(res != nullptr);
|
||||||
|
EXPECT_EQ(301, res->status);
|
||||||
|
|
||||||
|
httplib::url::options options;
|
||||||
|
options.follow_location = true;
|
||||||
|
|
||||||
|
res = httplib::url::Get("http://yahoo.com", options);
|
||||||
|
ASSERT_TRUE(res != nullptr);
|
||||||
|
EXPECT_EQ(200, res->status);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(HttpsToHttpRedirectTest, Redirect) {
|
TEST(HttpsToHttpRedirectTest, Redirect) {
|
||||||
httplib::SSLClient cli("httpbin.org");
|
httplib::SSLClient cli("httpbin.org");
|
||||||
cli.set_follow_location(true);
|
cli.set_follow_location(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue