diff --git a/src/Client.php b/src/Client.php index 6de3664..421b5e7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -27,7 +27,8 @@ class Client 'allow_redirects' => false, ]; - $this->http = new \GuzzleHttp\Client(array_merge($default,$config)); + $this->http = new \GuzzleHttp\Client(array_merge($default, $config)); + return $this; } /** @@ -83,7 +84,7 @@ class Client return $body['result']; } catch (\InvalidArgumentException $e) { - throw new RpcServerException('json decode error'); + throw new RpcServerException('json decode error', -32700); } } diff --git a/src/Providers/ClientServiceProvider.php b/src/Providers/ClientServiceProvider.php index 775ae56..eccc38e 100644 --- a/src/Providers/ClientServiceProvider.php +++ b/src/Providers/ClientServiceProvider.php @@ -23,7 +23,7 @@ class ClientServiceProvider extends ServiceProvider foreach ($config as $k => $item) { $this->app->singleton('rpc.' . $k, function () use ($k) { - app('rpc')->endpoint($k); + return app('rpc')->endpoint($k); }); } } diff --git a/src/Server/JsonRpcTool.php b/src/Server/JsonRpcTool.php index 49ce174..2c2fb17 100644 --- a/src/Server/JsonRpcTool.php +++ b/src/Server/JsonRpcTool.php @@ -40,7 +40,7 @@ class JsonRpcTool $method = $request->input('method'); try { - $result = app('rpc')->call($method, $params); + $result = app('rpc.auth')->call($method, $params); $view->share('result', json_encode($result, JSON_PRETTY_PRINT)); } catch (RpcServerException $exception) { $view->share('error', ['code' => $exception->getCode(), 'message' => $exception->getMessage()]); diff --git a/src/views/tool.blade.php b/src/views/tool.blade.php index b8b1904..d3e2826 100644 --- a/src/views/tool.blade.php +++ b/src/views/tool.blade.php @@ -2,7 +2,7 @@
{{$result}}
+ {{$result}}