Skip to content

Commit

Permalink
Optimized code for JsonRpcHttpTransporter (hyperf#3029)
Browse files Browse the repository at this point in the history
  • Loading branch information
assert6 committed Dec 26, 2020
1 parent 53a3060 commit ac6c196
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/json-rpc/src/JsonRpcHttpTransporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Hyperf\JsonRpc;

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
use Hyperf\Guzzle\ClientFactory;
use Hyperf\LoadBalancer\LoadBalancerInterface;
use Hyperf\LoadBalancer\Node;
Expand Down Expand Up @@ -81,11 +82,11 @@ public function send(string $data)
});
$url = $schema . $uri;
$response = $this->getClient()->post($url, [
'headers' => [
RequestOptions::HEADERS => [
'Content-Type' => 'application/json',
],
'http_errors' => false,
'body' => $data,
RequestOptions::HTTP_ERRORS => false,
RequestOptions::BODY => $data,
]);
if ($response->getStatusCode() === 200) {
return $response->getBody()->getContents();
Expand Down

0 comments on commit ac6c196

Please sign in to comment.