mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Code refactoring.
This commit is contained in:
parent
34f71312e8
commit
42473b722f
3 changed files with 85 additions and 77 deletions
19
test/test.cc
19
test/test.cc
|
@ -65,17 +65,20 @@ TEST(ServerTest, GetMethod)
|
|||
c.response.set_content(content);
|
||||
});
|
||||
|
||||
//svr.on_ready([&]() { svr.stop(); });
|
||||
|
||||
auto f = async([&](){ svr.run(); });
|
||||
|
||||
sleep(1);
|
||||
{
|
||||
Response res;
|
||||
Client(host, port).get(url, res);
|
||||
EXPECT_EQ(200, res.status);
|
||||
EXPECT_EQ(content, res.body);
|
||||
}
|
||||
|
||||
Client cli(host, port);
|
||||
|
||||
Response res;
|
||||
cli.get(url, res);
|
||||
EXPECT_EQ(content, res.body);
|
||||
{
|
||||
Response res;
|
||||
Client(host, port).get("/invalid", res);
|
||||
EXPECT_EQ(404, res.status);
|
||||
}
|
||||
|
||||
svr.stop();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue