mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-11 21:53:57 +00:00
Fixed test error
This commit is contained in:
parent
da26b517a3
commit
05e0253195
14
test/test.cc
14
test/test.cc
@ -668,6 +668,7 @@ TEST(HttpsToHttpRedirectTest, Redirect) {
|
|||||||
auto res =
|
auto res =
|
||||||
cli.Get("/redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302");
|
cli.Get("/redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302");
|
||||||
ASSERT_TRUE(res != nullptr);
|
ASSERT_TRUE(res != nullptr);
|
||||||
|
EXPECT_EQ(200, res->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(HttpsToHttpRedirectTestWithURL, Redirect) {
|
TEST(HttpsToHttpRedirectTestWithURL, Redirect) {
|
||||||
@ -676,8 +677,11 @@ TEST(HttpsToHttpRedirectTestWithURL, Redirect) {
|
|||||||
|
|
||||||
auto res = httplib::url::Get(
|
auto res = httplib::url::Get(
|
||||||
"https://httpbin.org/"
|
"https://httpbin.org/"
|
||||||
"redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302");
|
"redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302",
|
||||||
|
options);
|
||||||
|
|
||||||
ASSERT_TRUE(res != nullptr);
|
ASSERT_TRUE(res != nullptr);
|
||||||
|
EXPECT_EQ(200, res->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(RedirectToDifferentPort, Redirect) {
|
TEST(RedirectToDifferentPort, Redirect) {
|
||||||
@ -692,13 +696,9 @@ TEST(RedirectToDifferentPort, Redirect) {
|
|||||||
res.set_content("Hello World!", "text/plain");
|
res.set_content("Hello World!", "text/plain");
|
||||||
});
|
});
|
||||||
|
|
||||||
auto thread8080 = std::thread([&]() {
|
auto thread8080 = std::thread([&]() { svr8080.listen("localhost", 8080); });
|
||||||
svr8080.listen("localhost", 8080);
|
|
||||||
});
|
|
||||||
|
|
||||||
auto thread8081 = std::thread([&]() {
|
auto thread8081 = std::thread([&]() { svr8081.listen("localhost", 8081); });
|
||||||
svr8081.listen("localhost", 8081);
|
|
||||||
});
|
|
||||||
|
|
||||||
while (!svr8080.is_running() || !svr8081.is_running()) {
|
while (!svr8080.is_running() || !svr8081.is_running()) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user