Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

fix: Avoid deprecation warning about #basic_auth on Faraday::Connection #147

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/librato/metrics/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ def transport
end.tap do |transport|
transport.headers[:user_agent] = user_agent
transport.headers[:content_type] = 'application/json'
transport.basic_auth @client.email, @client.api_key
# The Basic Auth middleware usage differs before and after Faraday v2
if Gem::Version.new(Faraday::VERSION).segments.first >= 2
transport.request :authorization, :basic, @client.email, @client.api_key
else
transport.request :basic_auth, @client.email, @client.api_key
end
end
end

Expand Down Expand Up @@ -98,4 +103,4 @@ def transport_adapter
end

end
end
end