mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Added HEAD method support.
This commit is contained in:
parent
448a7f4f11
commit
b5ae7d0e7a
2 changed files with 44 additions and 17 deletions
19
test/test.cc
19
test/test.cc
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue