mana-ethereum / ethereumex

Elixir JSON-RPC client for the Ethereum blockchain 0x063D3d782598744AF1252eBEaf3aA97D990Edf72
MIT License
378 stars 73 forks source link

Issue with web3_client_version & default behaviour targeting Anvil and more? #158

Open arevaklg opened 8 months ago

arevaklg commented 8 months ago

Sorry if I am missing some page on issue guidelines or something. I looked around a bit but couldn't find one. Here is the TL;DR

Description

When running Ethereumex.HttpClient.web3_client_version() against an Anvil node, Anvil will respond with missing Content-Type header. It seems that somewhere along the way the library drops that header from this request at least. I know this because you can make this call Ethereumex.HttpClient.web3_client_version(http_headers: [{"Content-Type", "application/json"}]) and Anvil accepts the request. Since this request is a POST, and you are POSTing JSON, it seems appropriate to add the Content-Type header to the HTTP Request. Other RPCs like Alchemy happen to be a bit more lenient.

Reference:

ayrat555 commented 7 months ago

json header should be present by default https://github.com/mana-ethereum/ethereumex/commit/f051c4ae1e1739077e02f945e7ba5e982a5b8749