@@ -1457,6 +1457,20 @@ TEST_F(ServerTest, Gzip) {
1457
1457
EXPECT_EQ (200 , res->status );
1458
1458
}
1459
1459
1460
+ TEST_F (ServerTest, GzipWithoutAcceptEncoding) {
1461
+ Headers headers;
1462
+ auto res = cli_.Get (" /gzip" , headers);
1463
+
1464
+ ASSERT_TRUE (res != nullptr );
1465
+ EXPECT_EQ (" " , res->get_header_value (" Content-Encoding" ));
1466
+ EXPECT_EQ (" text/plain" , res->get_header_value (" Content-Type" ));
1467
+ EXPECT_EQ (" 100" , res->get_header_value (" Content-Length" ));
1468
+ EXPECT_EQ (" 123456789012345678901234567890123456789012345678901234567890123456"
1469
+ " 7890123456789012345678901234567890" ,
1470
+ res->body );
1471
+ EXPECT_EQ (200 , res->status );
1472
+ }
1473
+
1460
1474
TEST_F (ServerTest, GzipWithContentReceiver) {
1461
1475
Headers headers;
1462
1476
headers.emplace (" Accept-Encoding" , " gzip, deflate" );
@@ -1478,6 +1492,26 @@ TEST_F(ServerTest, GzipWithContentReceiver) {
1478
1492
EXPECT_EQ (200 , res->status );
1479
1493
}
1480
1494
1495
+ TEST_F (ServerTest, GzipWithContentReceiverWithoutAcceptEncoding) {
1496
+ Headers headers;
1497
+ std::string body;
1498
+ auto res = cli_.Get (" /gzip" , headers,
1499
+ [&](const char *data, uint64_t data_length,
1500
+ uint64_t /* offset*/ , uint64_t /* content_length*/ ) {
1501
+ body.append (data, data_length);
1502
+ return true ;
1503
+ });
1504
+
1505
+ ASSERT_TRUE (res != nullptr );
1506
+ EXPECT_EQ (" " , res->get_header_value (" Content-Encoding" ));
1507
+ EXPECT_EQ (" text/plain" , res->get_header_value (" Content-Type" ));
1508
+ EXPECT_EQ (" 100" , res->get_header_value (" Content-Length" ));
1509
+ EXPECT_EQ (" 123456789012345678901234567890123456789012345678901234567890123456"
1510
+ " 7890123456789012345678901234567890" ,
1511
+ body);
1512
+ EXPECT_EQ (200 , res->status );
1513
+ }
1514
+
1481
1515
TEST_F (ServerTest, NoGzip) {
1482
1516
Headers headers;
1483
1517
headers.emplace (" Accept-Encoding" , " gzip, deflate" );
0 commit comments