Added HEAD method support.

This commit is contained in:
yhirose committed 2012-10-12 17:41:58 -04:00
1 parent 448a7f4f11
commit b5ae7d0e7a
2 files changed
+44 -17

No files matched your search

+18 -1
View File
@@ -15,7 +15,7 @@ using namespace std;
using namespace httplib;
const char* HOST = "localhost";
const int PORT = 8080;
const int PORT = 1234;
class thread
{
@@ -260,6 +260,23 @@ TEST_F(ServerTest, GetMethod404)
EXPECT_EQ(404, res->status);
}
TEST_F(ServerTest, HeadMethod200)
{
auto res = cli_.head("/hi");
ASSERT_TRUE(res != nullptr);
EXPECT_EQ(200, res->status);
EXPECT_EQ("text/plain", res->get_header_value("Content-Type"));
EXPECT_EQ("", res->body);
}
TEST_F(ServerTest, HeadMethod404)
{
auto res = cli_.head("/invalid");
ASSERT_TRUE(res != nullptr);
EXPECT_EQ(404, res->status);
EXPECT_EQ("", res->body);
}
TEST_F(ServerTest, GetMethodPersonJohn)
{
auto res = cli_.get("/person/john");