@@ -2540,6 +2540,7 @@ TEST_F(ServerTest, StaticFileRange) {
25402540  EXPECT_EQ (" text/abcde" get_header_value (" Content-Type" 
25412541  EXPECT_EQ (" 2" get_header_value (" Content-Length" 
25422542  EXPECT_EQ (true , res->has_header (" Content-Range" 
2543+   EXPECT_EQ (" bytes 2-3/5" get_header_value (" Content-Range" 
25432544  EXPECT_EQ (std::string (" cd" body );
25442545}
25452546
@@ -2553,7 +2554,7 @@ TEST_F(ServerTest, StaticFileRanges) {
25532554          .find (
25542555              " multipart/byteranges; boundary=--cpp-httplib-multipart-data-" 
25552556      0 );
2556-   EXPECT_EQ (" 265 " get_header_value (" Content-Length" 
2557+   EXPECT_EQ (" 266 " get_header_value (" Content-Length" 
25572558}
25582559
25592560TEST_F (ServerTest, StaticFileRangeHead) {
@@ -2563,6 +2564,7 @@ TEST_F(ServerTest, StaticFileRangeHead) {
25632564  EXPECT_EQ (" text/abcde" get_header_value (" Content-Type" 
25642565  EXPECT_EQ (" 2" get_header_value (" Content-Length" 
25652566  EXPECT_EQ (true , res->has_header (" Content-Range" 
2567+   EXPECT_EQ (" bytes 2-3/5" get_header_value (" Content-Range" 
25662568}
25672569
25682570TEST_F (ServerTest, StaticFileRangeBigFile) {
@@ -2572,6 +2574,8 @@ TEST_F(ServerTest, StaticFileRangeBigFile) {
25722574  EXPECT_EQ (" text/plain" get_header_value (" Content-Type" 
25732575  EXPECT_EQ (" 5" get_header_value (" Content-Length" 
25742576  EXPECT_EQ (true , res->has_header (" Content-Range" 
2577+   EXPECT_EQ (" bytes 1048571-1048575/1048576" 
2578+             res->get_header_value (" Content-Range" 
25752579  EXPECT_EQ (" LAST\n " body );
25762580}
25772581
@@ -2582,6 +2586,7 @@ TEST_F(ServerTest, StaticFileRangeBigFile2) {
25822586  EXPECT_EQ (" text/plain" get_header_value (" Content-Type" 
25832587  EXPECT_EQ (" 4097" get_header_value (" Content-Length" 
25842588  EXPECT_EQ (true , res->has_header (" Content-Range" 
2589+   EXPECT_EQ (" bytes 1-4097/1048576" get_header_value (" Content-Range" 
25852590}
25862591
25872592TEST_F (ServerTest, StaticFileBigFile) {
@@ -2908,6 +2913,8 @@ TEST_F(ServerTest, GetStreamed2) {
29082913  ASSERT_TRUE (res);
29092914  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
29102915  EXPECT_EQ (" 2" get_header_value (" Content-Length" 
2916+   EXPECT_EQ (true , res->has_header (" Content-Range" 
2917+   EXPECT_EQ (" bytes 2-3/6" get_header_value (" Content-Range" 
29112918  EXPECT_EQ (std::string (" ab" body );
29122919}
29132920
@@ -2925,6 +2932,7 @@ TEST_F(ServerTest, GetStreamedWithRange1) {
29252932  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
29262933  EXPECT_EQ (" 3" get_header_value (" Content-Length" 
29272934  EXPECT_EQ (true , res->has_header (" Content-Range" 
2935+   EXPECT_EQ (" bytes 3-5/7" get_header_value (" Content-Range" 
29282936  EXPECT_EQ (std::string (" def" body );
29292937}
29302938
@@ -2934,6 +2942,7 @@ TEST_F(ServerTest, GetStreamedWithRange2) {
29342942  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
29352943  EXPECT_EQ (" 6" get_header_value (" Content-Length" 
29362944  EXPECT_EQ (true , res->has_header (" Content-Range" 
2945+   EXPECT_EQ (" bytes 1-6/7" get_header_value (" Content-Range" 
29372946  EXPECT_EQ (std::string (" bcdefg" body );
29382947}
29392948
@@ -2943,6 +2952,7 @@ TEST_F(ServerTest, GetStreamedWithRangeSuffix1) {
29432952  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
29442953  EXPECT_EQ (" 3" get_header_value (" Content-Length" 
29452954  EXPECT_EQ (true , res->has_header (" Content-Range" 
2955+   EXPECT_EQ (" bytes 4-6/7" get_header_value (" Content-Range" 
29462956  EXPECT_EQ (std::string (" efg" body );
29472957}
29482958
@@ -2952,6 +2962,7 @@ TEST_F(ServerTest, GetStreamedWithRangeSuffix2) {
29522962  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
29532963  EXPECT_EQ (" 7" get_header_value (" Content-Length" 
29542964  EXPECT_EQ (true , res->has_header (" Content-Range" 
2965+   EXPECT_EQ (" bytes 0-6/7" get_header_value (" Content-Range" 
29552966  EXPECT_EQ (std::string (" abcdefg" body );
29562967}
29572968
@@ -2968,6 +2979,7 @@ TEST_F(ServerTest, GetRangeWithMaxLongLength) {
29682979      cli_.Get (" /with-range" " Range" " bytes=0-9223372036854775807" 
29692980  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
29702981  EXPECT_EQ (" 7" get_header_value (" Content-Length" 
2982+   EXPECT_EQ (" bytes 0-6/7" get_header_value (" Content-Range" 
29712983  EXPECT_EQ (true , res->has_header (" Content-Range" 
29722984  EXPECT_EQ (std::string (" abcdefg" body );
29732985}
@@ -3029,6 +3041,7 @@ TEST_F(ServerTest, GetWithRange1) {
30293041  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
30303042  EXPECT_EQ (" 3" get_header_value (" Content-Length" 
30313043  EXPECT_EQ (true , res->has_header (" Content-Range" 
3044+   EXPECT_EQ (" bytes 3-5/7" get_header_value (" Content-Range" 
30323045  EXPECT_EQ (std::string (" def" body );
30333046}
30343047
@@ -3038,6 +3051,7 @@ TEST_F(ServerTest, GetWithRange2) {
30383051  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
30393052  EXPECT_EQ (" 6" get_header_value (" Content-Length" 
30403053  EXPECT_EQ (true , res->has_header (" Content-Range" 
3054+   EXPECT_EQ (" bytes 1-6/7" get_header_value (" Content-Range" 
30413055  EXPECT_EQ (std::string (" bcdefg" body );
30423056}
30433057
@@ -3047,6 +3061,7 @@ TEST_F(ServerTest, GetWithRange3) {
30473061  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
30483062  EXPECT_EQ (" 1" get_header_value (" Content-Length" 
30493063  EXPECT_EQ (true , res->has_header (" Content-Range" 
3064+   EXPECT_EQ (" bytes 0-0/7" get_header_value (" Content-Range" 
30503065  EXPECT_EQ (std::string (" a" body );
30513066}
30523067
@@ -3056,6 +3071,7 @@ TEST_F(ServerTest, GetWithRange4) {
30563071  EXPECT_EQ (StatusCode::PartialContent_206, res->status );
30573072  EXPECT_EQ (" 2" get_header_value (" Content-Length" 
30583073  EXPECT_EQ (true , res->has_header (" Content-Range" 
3074+   EXPECT_EQ (" bytes 5-6/7" get_header_value (" Content-Range" 
30593075  EXPECT_EQ (std::string (" fg" body );
30603076}
30613077
0 commit comments