diff --git a/tests/testhttp.nim b/tests/testhttp.nim index 86e1f90..e504ac5 100644 --- a/tests/testhttp.nim +++ b/tests/testhttp.nim @@ -1,19 +1,21 @@ -import unittest, json, chronicles -import ../rpcclient, ../rpchttpservers +import unittest, json, chronicles, unittest +import ../rpchttpservers var srv = newRpcHttpServer(["localhost:8545"]) -var client = newRpcStreamClient() +var client = newRpcHttpClient() # Create RPC on server srv.rpc("myProc") do(input: string, data: array[0..3, int]): result = %("Hello " & input & " data: " & $data) srv.start() -waitFor client.connect("localhost", Port(8545)) +waitFor client.httpConnect("localhost", Port(8545)) -var r = waitFor client.call("myProc", %[%"abc", %[1, 2, 3, 4]]) -echo r +suite "HTTP RPC transport": + test "Call": + var r = waitFor client.httpcall("myProc", %[%"abc", %[1, 2, 3, 4]]) + check r.error == false and r.result == %"Hello abc data: [1, 2, 3, 4]" -srv.stop() +srv.stop() srv.close() echo "done" \ No newline at end of file