From 49afd6ee768c3a92ed9265dee7540363e128ea17 Mon Sep 17 00:00:00 2001 From: coffeepots Date: Tue, 19 Jun 2018 18:22:01 +0100 Subject: [PATCH] Add simple test for HTTP (WIP) --- tests/testhttp.nim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/testhttp.nim diff --git a/tests/testhttp.nim b/tests/testhttp.nim new file mode 100644 index 0000000..9d9f01d --- /dev/null +++ b/tests/testhttp.nim @@ -0,0 +1,19 @@ +import unittest, json, chronicles +import ../rpcclient, ../rpchttpservers + +var srv = newRpcHttpServer(["localhost:8545"]) +var client = newRpcClient() + +# 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)) + +var r = waitFor client.call("myProc", %[%"abc", %[1, 2, 3, 4]]) +echo r + +srv.stop() +srv.close() +echo "done" \ No newline at end of file