mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 09:43:51 +00:00
Added a unit test for #1946
This commit is contained in:
parent
996acc5253
commit
10d68cff50
10
test/test.cc
10
test/test.cc
@ -3700,6 +3700,16 @@ TEST_F(ServerTest, GetRangeWithMaxLongLength) {
|
|||||||
EXPECT_EQ(0U, res->body.size());
|
EXPECT_EQ(0U, res->body.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ServerTest, GetRangeWithZeroToInfinite) {
|
||||||
|
auto res = cli_.Get("/with-range", {{"Range", "bytes=0-"}});
|
||||||
|
ASSERT_TRUE(res);
|
||||||
|
EXPECT_EQ(StatusCode::PartialContent_206, res->status);
|
||||||
|
EXPECT_EQ("7", res->get_header_value("Content-Length"));
|
||||||
|
EXPECT_EQ(true, res->has_header("Content-Range"));
|
||||||
|
EXPECT_EQ("bytes 0-6/7", res->get_header_value("Content-Range"));
|
||||||
|
EXPECT_EQ(std::string("abcdefg"), res->body);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ServerTest, GetStreamedWithRangeMultipart) {
|
TEST_F(ServerTest, GetStreamedWithRangeMultipart) {
|
||||||
auto res =
|
auto res =
|
||||||
cli_.Get("/streamed-with-range", {{make_range_header({{1, 2}, {4, 5}})}});
|
cli_.Get("/streamed-with-range", {{make_range_header({{1, 2}, {4, 5}})}});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user