mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Fixed test error
This commit is contained in:
parent
da26b517a3
commit
05e0253195
1 changed files with 7 additions and 7 deletions
14
test/test.cc
14
test/test.cc
|
@ -668,6 +668,7 @@ TEST(HttpsToHttpRedirectTest, Redirect) {
|
|||
auto res =
|
||||
cli.Get("/redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(200, res->status);
|
||||
}
|
||||
|
||||
TEST(HttpsToHttpRedirectTestWithURL, Redirect) {
|
||||
|
@ -676,8 +677,11 @@ TEST(HttpsToHttpRedirectTestWithURL, Redirect) {
|
|||
|
||||
auto res = httplib::url::Get(
|
||||
"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);
|
||||
EXPECT_EQ(200, res->status);
|
||||
}
|
||||
|
||||
TEST(RedirectToDifferentPort, Redirect) {
|
||||
|
@ -692,13 +696,9 @@ TEST(RedirectToDifferentPort, Redirect) {
|
|||
res.set_content("Hello World!", "text/plain");
|
||||
});
|
||||
|
||||
auto thread8080 = std::thread([&]() {
|
||||
svr8080.listen("localhost", 8080);
|
||||
});
|
||||
auto thread8080 = std::thread([&]() { svr8080.listen("localhost", 8080); });
|
||||
|
||||
auto thread8081 = std::thread([&]() {
|
||||
svr8081.listen("localhost", 8081);
|
||||
});
|
||||
auto thread8081 = std::thread([&]() { svr8081.listen("localhost", 8081); });
|
||||
|
||||
while (!svr8080.is_running() || !svr8081.is_running()) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue