mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-01-12 16:44:23 +00:00
Set correct content-type for JSON-RPC
This commit is contained in:
parent
34b7a82565
commit
0b951ce146
@ -50,14 +50,17 @@ template convertError(body) =
|
||||
|
||||
const defaultUrl = "http://localhost:8545"
|
||||
|
||||
proc jsonHeaders: seq[(string, string)] =
|
||||
@[("Content-Type", "application/json")]
|
||||
|
||||
proc connect(_: type RpcClient, url: string): Future[RpcClient] {.async.} =
|
||||
case parseUri(url).scheme
|
||||
of "ws", "wss":
|
||||
let client = newRpcWebSocketClient()
|
||||
let client = newRpcWebSocketClient(getHeaders = jsonHeaders)
|
||||
await client.connect(url)
|
||||
return client
|
||||
else:
|
||||
let client = newRpcHttpClient()
|
||||
let client = newRpcHttpClient(getHeaders = jsonHeaders)
|
||||
await client.connect(url)
|
||||
return client
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user