Add fix to handle integers values and cast them to string. Because only string is allowed

This commit is contained in:
Oleksandr Mykhailenko 2022-09-19 23:04:54 +03:00
parent 62bd235af7
commit 8c3840a1eb
2 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,11 @@
# Change Log
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
## 3.5.5
### Fixed
- Cast integer values to string for sending multipart data
## 3.5.4
### Added

View File

@ -16,6 +16,7 @@ use Mailgun\Exception\InvalidArgumentException;
use Mailgun\Message\BatchMessage;
use Mailgun\Model\Message\SendResponse;
use Mailgun\Model\Message\ShowResponse;
use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Message\ResponseInterface;
/**
@ -34,6 +35,7 @@ class Message extends HttpApi
* @see https://documentation.mailgun.com/en/latest/api-sending.html#sending
*
* @return SendResponse|ResponseInterface
* @throws \Exception|ClientExceptionInterface
*/
public function send(string $domain, array $params)
{
@ -164,6 +166,9 @@ class Message extends HttpApi
foreach ($params as $key => $value) {
// If $value is not an array we cast it to an array
foreach ((array) $value as $subValue) {
if (is_int($subValue)) {
$subValue = (string)$subValue;
}
$postDataMultipart[] = [
'name' => $key,
'content' => $subValue,