Skip to content

Commit

Permalink
Encode non-utf-8 response bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzondervan committed Nov 30, 2024
1 parent 21f5cf7 commit 107934e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/Service/CallService.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public function call(
'remoteIp' => $response->getHeaderLine('X-Real-IP') ?: $response->getHeaderLine('X-Forwarded-For') ?: null,
'headers' => $response->getHeaders(),
'body' => mb_check_encoding(value: $body, encoding: 'UTF-8') !== false ? $body : base64_encode($body),
'encoding' => mb_check_encoding(value: $body, encoding: 'UTF-8') !== false ? 'UTF-8' : 'base64',
]
];

Expand Down

0 comments on commit 107934e

Please sign in to comment.