@@ -2004,7 +2004,7 @@ TEST(ErrorHandlerTest, ContentLength) {
20042004 {
20052005 Client cli (HOST, PORT);
20062006
2007- auto res = cli.Get (" /hi" );
2007+ auto res = cli.Get (" /hi" , {{ " Accept-Encoding " , " " }} );
20082008 ASSERT_TRUE (res);
20092009 EXPECT_EQ (StatusCode::OK_200, res->status );
20102010 EXPECT_EQ (" text/html" , res->get_header_value (" Content-Type" ));
@@ -2087,7 +2087,7 @@ TEST(ExceptionTest, WithExceptionHandler) {
20872087 Client cli (HOST, PORT);
20882088
20892089 for (size_t j = 0 ; j < 100 ; j++) {
2090- auto res = cli.Get (" /hi" );
2090+ auto res = cli.Get (" /hi" , {{ " Accept-Encoding " , " " }} );
20912091 ASSERT_TRUE (res);
20922092 EXPECT_EQ (StatusCode::InternalServerError_500, res->status );
20932093 EXPECT_EQ (" text/html" , res->get_header_value (" Content-Type" ));
@@ -2098,7 +2098,7 @@ TEST(ExceptionTest, WithExceptionHandler) {
20982098 cli.set_keep_alive (true );
20992099
21002100 for (size_t j = 0 ; j < 100 ; j++) {
2101- auto res = cli.Get (" /hi" );
2101+ auto res = cli.Get (" /hi" , {{ " Accept-Encoding " , " " }} );
21022102 ASSERT_TRUE (res);
21032103 EXPECT_EQ (StatusCode::InternalServerError_500, res->status );
21042104 EXPECT_EQ (" text/html" , res->get_header_value (" Content-Type" ));
@@ -3803,7 +3803,10 @@ TEST_F(ServerTest, GetRangeWithMaxLongLength) {
38033803}
38043804
38053805TEST_F (ServerTest, GetRangeWithZeroToInfinite) {
3806- auto res = cli_.Get (" /with-range" , {{" Range" , " bytes=0-" }});
3806+ auto res = cli_.Get (" /with-range" , {
3807+ {" Range" , " bytes=0-" },
3808+ {" Accept-Encoding" , " " },
3809+ });
38073810 ASSERT_TRUE (res);
38083811 EXPECT_EQ (StatusCode::PartialContent_206, res->status );
38093812 EXPECT_EQ (" 7" , res->get_header_value (" Content-Length" ));
@@ -3899,7 +3902,10 @@ TEST_F(ServerTest, ClientStop) {
38993902}
39003903
39013904TEST_F (ServerTest, GetWithRange1) {
3902- auto res = cli_.Get (" /with-range" , {{make_range_header ({{3 , 5 }})}});
3905+ auto res = cli_.Get (" /with-range" , {
3906+ make_range_header ({{3 , 5 }}),
3907+ {" Accept-Encoding" , " " },
3908+ });
39033909 ASSERT_TRUE (res);
39043910 EXPECT_EQ (StatusCode::PartialContent_206, res->status );
39053911 EXPECT_EQ (" 3" , res->get_header_value (" Content-Length" ));
@@ -3909,7 +3915,10 @@ TEST_F(ServerTest, GetWithRange1) {
39093915}
39103916
39113917TEST_F (ServerTest, GetWithRange2) {
3912- auto res = cli_.Get (" /with-range" , {{make_range_header ({{1 , -1 }})}});
3918+ auto res = cli_.Get (" /with-range" , {
3919+ make_range_header ({{1 , -1 }}),
3920+ {" Accept-Encoding" , " " },
3921+ });
39133922 ASSERT_TRUE (res);
39143923 EXPECT_EQ (StatusCode::PartialContent_206, res->status );
39153924 EXPECT_EQ (" 6" , res->get_header_value (" Content-Length" ));
@@ -3919,7 +3928,10 @@ TEST_F(ServerTest, GetWithRange2) {
39193928}
39203929
39213930TEST_F (ServerTest, GetWithRange3) {
3922- auto res = cli_.Get (" /with-range" , {{make_range_header ({{0 , 0 }})}});
3931+ auto res = cli_.Get (" /with-range" , {
3932+ make_range_header ({{0 , 0 }}),
3933+ {" Accept-Encoding" , " " },
3934+ });
39233935 ASSERT_TRUE (res);
39243936 EXPECT_EQ (StatusCode::PartialContent_206, res->status );
39253937 EXPECT_EQ (" 1" , res->get_header_value (" Content-Length" ));
@@ -3929,7 +3941,10 @@ TEST_F(ServerTest, GetWithRange3) {
39293941}
39303942
39313943TEST_F (ServerTest, GetWithRange4) {
3932- auto res = cli_.Get (" /with-range" , {{make_range_header ({{-1 , 2 }})}});
3944+ auto res = cli_.Get (" /with-range" , {
3945+ make_range_header ({{-1 , 2 }}),
3946+ {" Accept-Encoding" , " " },
3947+ });
39333948 ASSERT_TRUE (res);
39343949 EXPECT_EQ (StatusCode::PartialContent_206, res->status );
39353950 EXPECT_EQ (" 2" , res->get_header_value (" Content-Length" ));
@@ -4674,7 +4689,9 @@ TEST_F(ServerTest, Gzip) {
46744689}
46754690
46764691TEST_F (ServerTest, GzipWithoutAcceptEncoding) {
4677- auto res = cli_.Get (" /compress" );
4692+ Headers headers;
4693+ headers.emplace (" Accept-Encoding" , " " );
4694+ auto res = cli_.Get (" /compress" , headers);
46784695
46794696 ASSERT_TRUE (res);
46804697 EXPECT_TRUE (res->get_header_value (" Content-Encoding" ).empty ());
@@ -4723,12 +4740,16 @@ TEST_F(ServerTest, GzipWithoutDecompressing) {
47234740}
47244741
47254742TEST_F (ServerTest, GzipWithContentReceiverWithoutAcceptEncoding) {
4743+ Headers headers;
4744+ headers.emplace (" Accept-Encoding" , " " );
4745+
47264746 std::string body;
4727- auto res = cli_.Get (" /compress" , [&](const char *data, uint64_t data_length) {
4728- EXPECT_EQ (100U , data_length);
4729- body.append (data, data_length);
4730- return true ;
4731- });
4747+ auto res = cli_.Get (" /compress" , headers,
4748+ [&](const char *data, uint64_t data_length) {
4749+ EXPECT_EQ (100U , data_length);
4750+ body.append (data, data_length);
4751+ return true ;
4752+ });
47324753
47334754 ASSERT_TRUE (res);
47344755 EXPECT_TRUE (res->get_header_value (" Content-Encoding" ).empty ());
0 commit comments