From cb98bc4666546aa8bc8e53a07ac6709d09e18306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=99=E5=AD=A6=E6=9D=B0?= Date: Mon, 7 Jan 2019 16:10:26 +0800 Subject: [PATCH] =?UTF-8?q?client=20=E8=B0=83=E7=94=A8=20=E4=BC=A0?= =?UTF-8?q?=E9=80=92=20app=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index 421b5e7..5d1d4ae 100644 --- a/src/Client.php +++ b/src/Client.php @@ -10,11 +10,18 @@ class Client protected $config; protected $id; + /** + * @var \GuzzleHttp\Client + */ protected $http; public function __construct($config) { - $this->config = $config; + $default = [ + 'app' => '***', + ]; + + $this->config = array_merge($default, $config); $this->id = 0; } @@ -68,7 +75,10 @@ class Client { try { $resp = $this->http->request('POST', 'rpc/json-rpc-v2.json', [ - 'json' => $payload + 'headers' => [ + 'hwmc_app' => $this->config['app'], + ], + 'json' => $payload, ]); } catch (ServerException $e) { throw new RpcServerException($e->getMessage(), $e->getCode());