diff --git a/src/Client.php b/src/Client.php index ce27964..b3a4bfe 100644 --- a/src/Client.php +++ b/src/Client.php @@ -432,7 +432,7 @@ private function request($method, $params) curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, \json_encode($params)); + curl_setopt($ch, CURLOPT_POSTFIELDS, \json_encode((object)$params)); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHeaders()); curl_setopt($ch, CURLOPT_URL, $this->getUrl($method)); $data = curl_exec($ch); diff --git a/tests/ClientTest.php b/tests/ClientTest.php index f2d5699..840acca 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -70,4 +70,11 @@ public function testPublishNetworkError() $client = new \phpcent\Client("http://localhost:9000/api"); $res = $client->publish('channel', ["message" => "Hello World"]); } + + public function testInfo() + { + $res = $this->client->info(); + $this->assertNotNull($res); + $this->assertTrue(is_array($res->result->nodes)); + } }