Skip to content

Commit

Permalink
work around bad request error message
Browse files Browse the repository at this point in the history
Morning-Train#10
do not send body option unless you have body contents
  • Loading branch information
zainengineer committed Oct 2, 2017
1 parent e05ba2a commit 9211d63
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TogglApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ public function __construct($api_token)

private function GET($endpoint, $body = array(), $query = array())
{
$response = $this->client->get($endpoint, ['body' => json_encode($body), 'query' => $query]);
$options = [
'query' => $query,
];
if ($body){
$options['body'] = json_encode($body);
}
$response = $this->client->get($endpoint, $options);
return $this->checkResponse($response);

}
Expand Down

0 comments on commit 9211d63

Please sign in to comment.