Skip to content

Commit d5fc09c

Browse files
committed
fix typo in 'threshold', rename to 'limit'
1 parent bfb140d commit d5fc09c

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ You may override its configuration in your `.env` - the following environment va
3636
- `HTTP_CLIENT_GLOBAL_LOGGER_OBFUSCATE_ENABLED` (bool)
3737
- `HTTP_CLIENT_GLOBAL_LOGGER_OBFUSCATE_REPLACEMENT` (string)
3838
- `HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_ENABLED` (bool)
39-
- `HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_TRESHOLD` (int)
39+
- `HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_LIMIT` (int)
4040
- `HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_CONTENT_TYPE_WHITELIST` (string)
4141

42-
(look into `config/http-client-global-logger.php` for further configuration and explanation)
42+
(look into `config/http-client-global-logger.php` for defaults, further configuration, and explanation)
4343

4444
## Features
4545

config/http-client-global-logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
*/
122122
'trim_response_body' => [
123123
'enabled' => env('HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_ENABLED', false),
124-
'treshold' => env('HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_TRESHOLD', 200),
124+
'limit' => env('HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_LIMIT', 200),
125125
'content_type_whitelist' => explode(',', env(
126126
'HTTP_CLIENT_GLOBAL_LOGGER_TRIM_RESPONSE_BODY_CONTENT_TYPE_WHITELIST',
127127
',application/json'

src/Listeners/LogResponseReceived.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ private function trimBody(Response $psrResponse): Response|MessageInterface
5757
return $psrResponse;
5858
}
5959

60-
$treshold = config('http-client-global-logger.trim_response_body.treshold');
60+
$limit = config('http-client-global-logger.trim_response_body.limit');
6161

62-
// Check if the body size exceeds the treshold
63-
return ($psrResponse->getBody()->getSize() <= $treshold)
62+
// Check if the body size exceeds the limit
63+
return ($psrResponse->getBody()->getSize() <= $limit)
6464
? $psrResponse
6565
: $psrResponse->withBody(Utils::streamFor(
66-
Str::limit($psrResponse->getBody(), $treshold)
66+
Str::limit($psrResponse->getBody(), $limit)
6767
));
6868
}
6969
}

tests/HttpClientLoggerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ function setupLogger(): MockInterface
6969
'disabled' => [
7070
'config' => [
7171
'enabled' => false,
72-
'treshold' => 10,
72+
'limit' => 10,
7373
'content_type_whitelist' => ['application/json'],
7474
],
7575
'contentType' => 'application/octet-stream',
7676
'shouldTrim' => false,
7777
],
78-
'below_treshold' => [
78+
'below_limit' => [
7979
'config' => [
8080
'enabled' => true,
81-
'treshold' => 20,
81+
'limit' => 20,
8282
'content_type_whitelist' => ['application/json'],
8383
],
8484
'contentType' => 'application/octet-stream',
@@ -87,7 +87,7 @@ function setupLogger(): MockInterface
8787
'content_type_whitelisted' => [
8888
'config' => [
8989
'enabled' => true,
90-
'treshold' => 10,
90+
'limit' => 10,
9191
'content_type_whitelist' => ['application/octet-stream'],
9292
],
9393
'contentType' => 'application/octet-stream',
@@ -96,7 +96,7 @@ function setupLogger(): MockInterface
9696
'trim' => [
9797
'config' => [
9898
'enabled' => true,
99-
'treshold' => 10,
99+
'limit' => 10,
100100
'content_type_whitelist' => ['application/json'],
101101
],
102102
'contentType' => 'application/octet-stream',
@@ -105,7 +105,7 @@ function setupLogger(): MockInterface
105105
'no_content_type_trim' => [
106106
'config' => [
107107
'enabled' => true,
108-
'treshold' => 10,
108+
'limit' => 10,
109109
'content_type_whitelist' => ['application/octet-stream'],
110110
],
111111
'contentType' => '',
@@ -114,7 +114,7 @@ function setupLogger(): MockInterface
114114
'no_content_type_whitelisted' => [
115115
'config' => [
116116
'enabled' => true,
117-
'treshold' => 10,
117+
'limit' => 10,
118118
'content_type_whitelist' => ['', 'application/octet-stream'],
119119
],
120120
'contentType' => '',

0 commit comments

Comments
 (0)