Added ServerTest.

This commit is contained in:
yhirose 2012-09-27 20:54:54 -04:00
parent 0a26cd08f0
commit ac5c13620c
2 changed files with 37 additions and 7 deletions

View file

@ -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