Skip to content

Commit

Permalink
Remove runtime dependency on base64 (#1541)
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Dec 27, 2023
1 parent 7e12133 commit 9487833
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion faraday.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.6'

spec.add_dependency 'base64'
# faraday-net_http is the "default adapter", but being a Faraday dependency it can't
# control which version of faraday it will be pulled from.
# To avoid releasing a major version every time there's a new Faraday API, we should
Expand Down
3 changes: 1 addition & 2 deletions lib/faraday/utils.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require 'base64'
require 'uri'
require 'faraday/utils/headers'
require 'faraday/utils/params_hash'
Expand Down Expand Up @@ -54,7 +53,7 @@ def default_params_encoder
end

def basic_header_from(login, pass)
value = Base64.encode64("#{login}:#{pass}")
value = ["#{login}:#{pass}"].pack('m') # Base64 encoding
value.delete!("\n")
"Basic #{value}"
end
Expand Down

0 comments on commit 9487833

Please sign in to comment.