Skip to content

Commit

Permalink
Add fix to handle integers values and cast them to string. Because on…
Browse files Browse the repository at this point in the history
…ly string is allowed
  • Loading branch information
oleksandr-mykhailenko committed Sep 19, 2022
1 parent 62bd235 commit 8c3840a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/Api/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Mailgun\Message\BatchMessage;
use Mailgun\Model\Message\SendResponse;
use Mailgun\Model\Message\ShowResponse;
use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Message\ResponseInterface;

/**
Expand All @@ -34,6 +35,7 @@ public function getBatchMessage(string $domain, bool $autoSend = true): BatchMes
* @see https://documentation.mailgun.com/en/latest/api-sending.html#sending
*
* @return SendResponse|ResponseInterface
* @throws \Exception|ClientExceptionInterface
*/
public function send(string $domain, array $params)
{
Expand Down Expand Up @@ -164,6 +166,9 @@ private function prepareMultipartParameters(array $params): array
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,
Expand Down

0 comments on commit 8c3840a

Please sign in to comment.