Skip to content

Commit 4e7a2bf

Browse files
committed
fix: LogTrait
1 parent fe16f07 commit 4e7a2bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/LogTrait.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ public function logRequest(RequestInterface $request): void
8989
*/
9090
protected function requestBodyCleanup(RequestInterface $request): string
9191
{
92-
$body = $request->getBody();
92+
$body = $request->getBody()->getContents();
9393
if (empty($body)) {
9494
return '(empty)';
9595
}
9696

97-
$data = json_decode((string)$body, true);
97+
$data = (array)json_decode($body, true);
9898
foreach (['password', 'old_password', 'confirm-password'] as $field) {
9999
$this->maskPasswordField($data, $field);
100100
}
@@ -168,12 +168,12 @@ public function logResponse(ResponseInterface $response): void
168168
*/
169169
protected function responseBodyCleanup(ResponseInterface $response): string
170170
{
171-
$body = $response->getBody();
171+
$body = $response->getBody()->getContents();
172172
if (empty($body)) {
173173
return '(empty)';
174174
}
175175

176-
$data = json_decode((string)$body, true);
176+
$data = (array)json_decode($body, true);
177177
foreach (['jwt', 'renew'] as $tok) {
178178
if (!empty($data['meta'][$tok])) {
179179
$data['meta'][$tok] = '***************';

0 commit comments

Comments
 (0)