mana-ethereum/ethereumex

Issue with web3_client_version & default behaviour targeting Anvil and more?

Opened this issue · 1 comments

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:

json header should be present by default f051c4a