Skip to content

Commit

Permalink
Merge pull request #25 from ppicatto/allow-empty-body
Browse files Browse the repository at this point in the history
Updated `post` method in order to support empty options
  • Loading branch information
mrVrAlex authored Aug 29, 2017
2 parents 087cba2 + 8213116 commit 279d2ab
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ public function get($url, $organizationId, $id, array $params = [])
*/
public function post($url, $organizationId, array $data = [], array $params = [])
{
return $this->processResult($this->httpClient->post(
$url,
[
'query' => $params + $this->getParams($organizationId),
'form_params' => ['JSONString' => \GuzzleHttp\json_encode($data)],
]
));
$body = [
'query' => $params + $this->getParams($organizationId),
];
if ($data) {
$body['form_params'] = ['JSONString' => \GuzzleHttp\json_encode($data)];
}
return $this->processResult($this->httpClient->post($url, $body));
}

/**
Expand Down

0 comments on commit 279d2ab

Please sign in to comment.