Skip to content

Commit

Permalink
Test reading empty zero-length file (yhirose#1931)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulharris authored Sep 9, 2024
1 parent e612154 commit 2d01e71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2916,6 +2916,15 @@ TEST_F(ServerTest, GetMethod200) {
EXPECT_EQ("Hello World!", res->body);
}

TEST_F(ServerTest, GetEmptyFile) {
auto res = cli_.Get("/empty_file");
ASSERT_TRUE(res);
EXPECT_EQ(StatusCode::OK_200, res->status);
EXPECT_EQ("text/plain", res->get_header_value("Content-Type"));
EXPECT_EQ(0, std::stoi(res->get_header_value("Content-Length")));
EXPECT_EQ("", res->body);
}

TEST_F(ServerTest, GetFileContent) {
auto res = cli_.Get("/file_content");
ASSERT_TRUE(res);
Expand Down
Empty file added test/www/empty_file
Empty file.

0 comments on commit 2d01e71

Please sign in to comment.