@@ -44,7 +44,7 @@ function setupLogger(): MockInterface
4444 Http::fake ()->get ('https://example.com ' );
4545});
4646
47- it ('can trim the body response ' , function (array $ config , bool $ shouldTrim , bool $ addCharsetToContentType ) {
47+ it ('can trim the body response ' , function (array $ config , string $ contentType , bool $ shouldTrim , bool $ addCharsetToContentType ) {
4848 config (['http-client-global-logger.trim_response_body ' => $ config ]);
4949
5050 $ logger = setupLogger ();
@@ -61,7 +61,7 @@ function setupLogger(): MockInterface
6161
6262 Http::fake ([
6363 '* ' => Http::response ('verylongbody ' , 200 , [
64- 'content-type ' => ' application/octet-stream ' .($ addCharsetToContentType ? '; charset=UTF-8 ' : '' ),
64+ 'Content-Type ' => $ contentType .($ addCharsetToContentType ? '; charset=UTF-8 ' : '' ),
6565 ]),
6666 ])->get ('https://example.com ' );
6767})->with (
@@ -72,6 +72,7 @@ function setupLogger(): MockInterface
7272 'treshold ' => 10 ,
7373 'content_type_whitelist ' => ['application/json ' ],
7474 ],
75+ 'contentType ' => 'application/octet-stream ' ,
7576 'shouldTrim ' => false ,
7677 ],
7778 'below_treshold ' => [
@@ -80,6 +81,7 @@ function setupLogger(): MockInterface
8081 'treshold ' => 20 ,
8182 'content_type_whitelist ' => ['application/json ' ],
8283 ],
84+ 'contentType ' => 'application/octet-stream ' ,
8385 'shouldTrim ' => false ,
8486 ],
8587 'content_type_whitelisted ' => [
@@ -88,6 +90,7 @@ function setupLogger(): MockInterface
8890 'treshold ' => 10 ,
8991 'content_type_whitelist ' => ['application/octet-stream ' ],
9092 ],
93+ 'contentType ' => 'application/octet-stream ' ,
9194 'shouldTrim ' => false ,
9295 ],
9396 'trim ' => [
@@ -96,8 +99,27 @@ function setupLogger(): MockInterface
9699 'treshold ' => 10 ,
97100 'content_type_whitelist ' => ['application/json ' ],
98101 ],
102+ 'contentType ' => 'application/octet-stream ' ,
99103 'shouldTrim ' => true ,
100104 ],
105+ 'no_content_type_trim ' => [
106+ 'config ' => [
107+ 'enabled ' => true ,
108+ 'treshold ' => 10 ,
109+ 'content_type_whitelist ' => ['application/octet-stream ' ],
110+ ],
111+ 'contentType ' => '' ,
112+ 'shouldTrim ' => true ,
113+ ],
114+ 'no_content_type_whitelisted ' => [
115+ 'config ' => [
116+ 'enabled ' => true ,
117+ 'treshold ' => 10 ,
118+ 'content_type_whitelist ' => ['' , 'application/octet-stream ' ],
119+ ],
120+ 'contentType ' => '' ,
121+ 'shouldTrim ' => false ,
122+ ],
101123 ],
102124 [true , false ]
103125);
0 commit comments