Commit db940cc0 authored by Armando Lüscher's avatar Armando Lüscher Committed by GitHub

Merge pull request #375 from noplanman/fix_request_params

Fix Telegram request parameters
parents c9f4785e 4045700c
......@@ -178,12 +178,16 @@ class Request
private static function setUpRequestParams(array $data)
{
$has_resource = false;
$multipart = [];
$multipart = [];
// Convert any nested arrays into JSON strings.
array_walk($data, function (&$item) {
is_array($item) && $item = json_encode($item);
});
//Reformat data array in multipart way if it contains a resource
foreach ($data as $key => $item) {
$has_resource |= is_resource($item);
is_array($item) && $item = json_encode($item);
$multipart[] = ['name' => $key, 'contents' => $item];
}
if ($has_resource) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment