From 75614bf29411fa2d6ee69f86dee243a9c03ce32e Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Tue, 19 Jul 2016 14:58:31 +0200 Subject: [PATCH] Build a string query form array Fix issue #122 --- src/Mailgun/Connection/RestClient.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Mailgun/Connection/RestClient.php b/src/Mailgun/Connection/RestClient.php index 1cdc2ee..a89884f 100644 --- a/src/Mailgun/Connection/RestClient.php +++ b/src/Mailgun/Connection/RestClient.php @@ -62,7 +62,7 @@ class RestClient /** * @param string $method * @param string $uri - * @param array $body + * @param mixed $body * @param array $files * @param array $headers * @@ -81,6 +81,8 @@ class RestClient if (!empty($files)) { $body = new MultipartStream($files); $headers['Content-Type'] = 'multipart/form-data; boundary='.$body->getBoundary(); + } elseif (is_array($body)) { + $body = http_build_query($body); } $request = new Request($method, $this->getApiUrl($uri), $headers, $body); @@ -101,7 +103,7 @@ class RestClient * @throws MissingEndpoint * @throws MissingRequiredParameters */ - public function post($endpointUrl, $postData = array(), $files = array()) + public function post($endpointUrl, array $postData = array(), $files = array()) { $postFiles = []; @@ -171,7 +173,7 @@ class RestClient /** * @param string $endpointUrl - * @param array $putData + * @param mixed $putData * * @return \stdClass *