mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-22 20:46:03 +03:00
parent
976a76a3b5
commit
75614bf294
@ -62,7 +62,7 @@ class RestClient
|
|||||||
/**
|
/**
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param string $uri
|
* @param string $uri
|
||||||
* @param array $body
|
* @param mixed $body
|
||||||
* @param array $files
|
* @param array $files
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
*
|
*
|
||||||
@ -81,6 +81,8 @@ class RestClient
|
|||||||
if (!empty($files)) {
|
if (!empty($files)) {
|
||||||
$body = new MultipartStream($files);
|
$body = new MultipartStream($files);
|
||||||
$headers['Content-Type'] = 'multipart/form-data; boundary='.$body->getBoundary();
|
$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);
|
$request = new Request($method, $this->getApiUrl($uri), $headers, $body);
|
||||||
@ -101,7 +103,7 @@ class RestClient
|
|||||||
* @throws MissingEndpoint
|
* @throws MissingEndpoint
|
||||||
* @throws MissingRequiredParameters
|
* @throws MissingRequiredParameters
|
||||||
*/
|
*/
|
||||||
public function post($endpointUrl, $postData = array(), $files = array())
|
public function post($endpointUrl, array $postData = array(), $files = array())
|
||||||
{
|
{
|
||||||
$postFiles = [];
|
$postFiles = [];
|
||||||
|
|
||||||
@ -171,7 +173,7 @@ class RestClient
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $endpointUrl
|
* @param string $endpointUrl
|
||||||
* @param array $putData
|
* @param mixed $putData
|
||||||
*
|
*
|
||||||
* @return \stdClass
|
* @return \stdClass
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user