diff --git a/src/HttpDriver/Session.php b/src/HttpDriver/Session.php index 9866376d..9e0bd7d0 100644 --- a/src/HttpDriver/Session.php +++ b/src/HttpDriver/Session.php @@ -193,6 +193,7 @@ public function prepareRequest(Pipeline $pipeline) $body = json_encode([ 'statements' => $statements, ]); + $headers = [ [ 'X-Stream' => true, @@ -205,15 +206,11 @@ public function prepareRequest(Pipeline $pipeline) private function formatParams(array $params) { - foreach ($params as $key => $v) { - if (is_array($v)) { - if (empty($v)) { - $params[$key] = new \stdClass(); - } else { - $params[$key] = $this->formatParams($params[$key]); - } + array_walk_recursive($params, function(&$v, $k) { + if (is_array($v) && count($v) === 0) { + $v = new \stdClass(); } - } + }); return $params; } diff --git a/tests/Issues/Issue99Test.php b/tests/Issues/Issue99Test.php new file mode 100644 index 00000000..2819e97c --- /dev/null +++ b/tests/Issues/Issue99Test.php @@ -0,0 +1,24 @@ + ['id' => 123, 'some' => []]]; + + $result = $this->client->run($q, $params); + + $this->assertEquals(1, $result->size()); + } +} \ No newline at end of file