Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue : in Faraday::connection : basic_auth method is deprecated #15

Open
mqu opened this issue Jul 8, 2023 · 1 comment
Open

issue : in Faraday::connection : basic_auth method is deprecated #15

mqu opened this issue Jul 8, 2023 · 1 comment

Comments

@mqu
Copy link

mqu commented Jul 8, 2023

when running this code, I have an error:

conn = Faraday.new { |c|
  c.adapter Faraday.default_adapter
  c.ssl.verify = false  # This is a baaaad idea!
  c.basic_auth('username', 'password')
}
client = JSONRPC::Client.new(url, { connection: conn })
  • undefined method `basic_auth' for "#<Faraday::Connection.."
./ruby-json-rpc-client.rb:17:in `block in <main>': undefined method `basic_auth' for #<Faraday::Connection:0x00007feafe050cd0 @parallel_manager=nil, @headers={}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @manual_proxy=false, @builder=#<Faraday::RackBuilder:0x00007feafe057918 @adapter=Faraday::Adapter::NetHttp, @handlers=[]>, @url_prefix=#<URI::HTTP http:/>, @proxy=nil> (NoMethodError)

  c.basic_auth('username', 'password')
   ^^^^^^^^^^^
	from /var/lib/gems/3.1.0/gems/faraday-2.7.10/lib/faraday/connection.rb:91:in `initialize'
	from /var/lib/gems/3.1.0/gems/faraday-2.7.10/lib/faraday.rb:98:in `new'
	from /var/lib/gems/3.1.0/gems/faraday-2.7.10/lib/faraday.rb:98:in `new'
	from ./ruby-json-rpc-client.rb:14:in `<main>'

need to change in :

conn = Faraday.new { |c|
  c.adapter Faraday.default_adapter
  c.ssl.verify = false  # This is a baaaad idea!
  c.request :authorization, :basic, "user", "password"
}
client = JSONRPC::Client.new(url, { connection: conn })

perhaps you should update documentation.

@fxposter
Copy link
Owner

fxposter commented Jul 9, 2023

Hello. You are welcome to do the PR if the Faraday APIs have changed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants