Skip to content

Commit 88d8d83

Browse files
authored
Merge pull request #7 from BrightLocal/fix/depricated-calls
Fix batch api
2 parents 51096b6 + fed8683 commit 88d8d83

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/BrightLocal/Api.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
use GuzzleHttp\Client;
55
use GuzzleHttp\Exception\RequestException;
6-
use Exception;
76

87
/**
98
* Class Api
@@ -82,13 +81,15 @@ public function call($method, $params = array(), $httpMethod = self::HTTP_METHOD
8281
if ($httpMethod === static::HTTP_METHOD_GET) {
8382
$result = $client->get($this->endpoint . '/' . ltrim($method, '/'), array('query' => $params));
8483
} else {
85-
$result = $client->$httpMethod($this->endpoint . '/' . ltrim($method, '/'), array('body' => $params));
84+
$result = $client->$httpMethod($this->endpoint . '/' . ltrim($method, '/'), array('form_params' => $params));
8685
}
8786
} catch (RequestException $e) {
8887
$result = $e->getResponse();
8988
}
9089
$this->lastHttpCode = $result->getStatusCode();
91-
return $result->json();
90+
$content = $result->getBody()->getContents();
91+
$result->getBody()->close();
92+
return \GuzzleHttp\json_decode($content, true);
9293
}
9394

9495
/**

0 commit comments

Comments
 (0)