From b2792c932acc161ec01d0f06083457d9abb9ff9f Mon Sep 17 00:00:00 2001 From: groot Date: Sat, 15 Aug 2020 15:52:15 +0800 Subject: [PATCH] add support for http basic auth --- lib/web3/eth/rpc.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/web3/eth/rpc.rb b/lib/web3/eth/rpc.rb index 095dcc2..033950a 100644 --- a/lib/web3/eth/rpc.rb +++ b/lib/web3/eth/rpc.rb @@ -38,6 +38,7 @@ def request method, params = nil Net::HTTP.start(@uri.host, @uri.port, @connect_options) do |http| request = Net::HTTP::Post.new @uri, {"Content-Type" => "application/json"} + request.basic_auth(@uri.user, @uri.password) if @uri.user && @uri.password request.body = {:jsonrpc => JSON_RPC_VERSION, method: method, params: params, id: @client_id}.compact.to_json response = http.request request