mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Added 'Content-Range' header for single range request
This commit is contained in:
parent
9785cd47f2
commit
c899462e75
2 changed files with 31 additions and 7 deletions
|
@ -1146,6 +1146,7 @@ TEST_F(ServerTest, GetStreamedWithRange1) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("3", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(true, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(std::string("def"), res->body);
|
||||
}
|
||||
|
||||
|
@ -1154,6 +1155,7 @@ TEST_F(ServerTest, GetStreamedWithRange2) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("6", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(true, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(std::string("bcdefg"), res->body);
|
||||
}
|
||||
|
||||
|
@ -1163,6 +1165,7 @@ TEST_F(ServerTest, GetStreamedWithRangeMultipart) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("269", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(false, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(269, res->body.size());
|
||||
}
|
||||
|
||||
|
@ -1171,6 +1174,7 @@ TEST_F(ServerTest, GetWithRange1) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("3", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(true, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(std::string("def"), res->body);
|
||||
}
|
||||
|
||||
|
@ -1179,6 +1183,7 @@ TEST_F(ServerTest, GetWithRange2) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("6", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(true, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(std::string("bcdefg"), res->body);
|
||||
}
|
||||
|
||||
|
@ -1187,6 +1192,7 @@ TEST_F(ServerTest, GetWithRange3) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("1", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(true, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(std::string("a"), res->body);
|
||||
}
|
||||
|
||||
|
@ -1195,6 +1201,7 @@ TEST_F(ServerTest, GetWithRange4) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("2", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(true, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(std::string("fg"), res->body);
|
||||
}
|
||||
|
||||
|
@ -1203,6 +1210,7 @@ TEST_F(ServerTest, GetWithRangeMultipart) {
|
|||
ASSERT_TRUE(res != nullptr);
|
||||
EXPECT_EQ(206, res->status);
|
||||
EXPECT_EQ("269", res->get_header_value("Content-Length"));
|
||||
EXPECT_EQ(false, res->has_header("Content-Range"));
|
||||
EXPECT_EQ(269, res->body.size());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue