Skip to content

Commit

Permalink
Merge pull request #187 from plivo/SUP-1677
Browse files Browse the repository at this point in the history
JSON FORCE OBJECT encoding done only for empty PHP Arrays
  • Loading branch information
nixonsam authored Sep 17, 2020
2 parents d696880 + f9e9658 commit 257d1eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [v4.11.1](https://github.com/plivo/plivo-php/releases/tag/v4.11.1) - 2020-09-17
- Fix "Media is invalid" error while using Send MMS API.

## [v4.11.0](https://github.com/plivo/plivo-php/releases/tag/v4.11.0) - 2020-08-25
- Add Powerpack for mms.

Expand Down
5 changes: 4 additions & 1 deletion src/Plivo/HttpClients/PlivoGuzzleHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ public function send_request($url, $method, $body, $headers, $timeOut, $request)
$headers["Authorization"] = "Basic " . base64_encode("$this->authId:$this->authToken");
$request->setHeaders($headers);
$options =[];
$requestBody = json_encode($request->getParams(), JSON_FORCE_OBJECT);
$requestBody = json_encode($request->getParams());
if(empty($request->getParams())){
$requestBody = json_encode($request->getParams(), JSON_FORCE_OBJECT);
}
if (array_key_exists("isCallInsightsRequest", $request->getParams())) {
unset($request->getParams()['isCallInsightsRequest']);
$requestBody = $requestBody;
Expand Down

0 comments on commit 257d1eb

Please sign in to comment.