mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Added ServerTest.
This commit is contained in:
parent
0a26cd08f0
commit
ac5c13620c
2 changed files with 37 additions and 7 deletions
17
test/test.cc
17
test/test.cc
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
#include <httpsvrkit.h>
|
||||
#include <future>
|
||||
|
||||
using namespace std;
|
||||
using namespace httpsvrkit;
|
||||
|
@ -50,4 +51,20 @@ TEST(GetHeaderValueTest, RegularValue)
|
|||
ASSERT_STREQ("text/html", val);
|
||||
}
|
||||
|
||||
TEST(ServerTest, GetMethod)
|
||||
{
|
||||
Server svr("localhost", 1914);
|
||||
|
||||
svr.get("hi", [&](httpsvrkit::Context& cxt) {
|
||||
cxt.response.set_content("Hello World!");
|
||||
});
|
||||
|
||||
svr.on_ready([&]() {
|
||||
// TODO: HTTP GET request...
|
||||
svr.stop();
|
||||
});
|
||||
|
||||
auto f = async([&](){ svr.run(); });
|
||||
}
|
||||
|
||||
// vim: et ts=4 sw=4 cin cino={1s ff=unix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue