mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-22 20:58:30 +00:00
static file support. vc12 support.
This commit is contained in:
parent
a9b34615c7
commit
eef74af19b
10 changed files with 308 additions and 222 deletions
test
20
test/test.cc
20
test/test.cc
|
@ -103,6 +103,8 @@ protected:
|
|||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
svr_.set_base_dir("./www");
|
||||
|
||||
svr_.get("/hi", [&](const Request& req, Response& res) {
|
||||
res.set_content("Hello World!", "text/plain");
|
||||
});
|
||||
|
@ -247,6 +249,24 @@ TEST_F(ServerTest, PostMethod2)
|
|||
ASSERT_EQ("coder", res->body);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, GetMethodDir)
|
||||
{
|
||||
auto res = cli_.get("/dir/");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(200, res->status);
|
||||
EXPECT_EQ("text/html", res->get_header_value("Content-Type"));
|
||||
EXPECT_EQ("index.html", res->body);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, GetMethodDirTest)
|
||||
{
|
||||
auto res = cli_.get("/dir/test.html");
|
||||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(200, res->status);
|
||||
EXPECT_EQ("text/html", res->get_header_value("Content-Type"));
|
||||
EXPECT_EQ("test.html", res->body);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
TEST(CleanupTest, WSACleanup)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue