Skip to content

Commit

Permalink
Merge pull request #7 from C3rb/patch-1
Browse files Browse the repository at this point in the history
Typed format for symfony/serializer^5.0 and PHP 7.4 for Travis
  • Loading branch information
alanbem committed Feb 23, 2021
2 parents 1631f88 + 4ac5514 commit e632f4b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Josser/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Josser\Exception\RequestResponseMismatchException;
use Josser\Client\Request\Request;
use Josser\Client\Request\Notification;
use Symfony\Component\Serializer\Encoder\JsonEncoder;

/**
* JSON-RPC client.
Expand Down Expand Up @@ -104,14 +105,14 @@ public function call(RequestInterface $request, TransportInterface $transport =
}

$requestDTO = $protocol->getRequestDataTransferObject($request);
$encodedRequest = $protocol->getEncoder()->encode($requestDTO, null);
$encodedRequest = $protocol->getEncoder()->encode($requestDTO, JsonEncoder::FORMAT);
$encodedResponse = $transport->send($encodedRequest);

if($protocol->isNotification($request)) {
return new NoResponse();
}

$responseDTO = $protocol->getDecoder()->decode($encodedResponse, null);
$responseDTO = $protocol->getDecoder()->decode($encodedResponse, JsonEncoder::FORMAT);
$response = $protocol->createResponse($responseDTO);

if(!$protocol->match($request, $response)) {
Expand Down

0 comments on commit e632f4b

Please sign in to comment.