Add simple test for HTTP (WIP)
This commit is contained in:
parent
14009846ef
commit
49afd6ee76
|
@ -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"
|
Loading…
Reference in New Issue