Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Merge pull request #147 from ramunasd/fix_double_json_decode
Browse files Browse the repository at this point in the history
Remove redundant json_decode() on result set, minor improvements
  • Loading branch information
ikwattro authored Jan 3, 2019
2 parents 3e90a37 + d43284c commit 3819d87
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/HttpDriver/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
use Http\Client\Common\Plugin\ErrorPlugin;
use Http\Client\Common\PluginClient;
use Http\Client\Exception\HttpException;
use Http\Client\Exception\RequestException;
use Http\Client\HttpClient;
use Http\Discovery\MessageFactoryDiscovery;
use Http\Message\RequestFactory;
use Psr\Http\Message\RequestInterface;

Expand Down Expand Up @@ -63,7 +61,7 @@ class Session implements SessionInterface
/**
* @param string $uri
* @param GuzzleClient|HttpClient $httpClient
* @param BaseConfiguration $config
* @param ConfigInterface $config
*/
public function __construct($uri, $httpClient, ConfigInterface $config)
{
Expand Down Expand Up @@ -154,9 +152,8 @@ public function flush(Pipeline $pipeline)

throw $exception;
}
$results = $this->responseFormatter->format(json_decode($response->getBody(), true), $pipeline->statements());

return $results;
return $this->responseFormatter->format($data, $pipeline->statements());
} catch (HttpException $e) {
$body = json_decode($e->getResponse()->getBody(), true);
if (!isset($body['code'])) {
Expand Down Expand Up @@ -287,7 +284,7 @@ public function pushToTransaction($transactionId, array $statementsStack)
throw $exception;
}

return $this->responseFormatter->format(json_decode($response->getBody(), true), $statementsStack);
return $this->responseFormatter->format($data, $statementsStack);
} catch (HttpException $e) {
$body = json_decode($e->getResponse()->getBody(), true);
if (!isset($body['code'])) {
Expand Down

0 comments on commit 3819d87

Please sign in to comment.