Skip to content

Commit

Permalink
bump httpx dependency to 1.0 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoneyryderChuck committed Oct 4, 2023
1 parent 1a08069 commit e90927d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion down.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "minitest", "~> 5.8"
spec.add_development_dependency "mocha", "~> 1.5"
spec.add_development_dependency "rake"
spec.add_development_dependency "httpx", "~> 0.22", ">= 0.22.2"
spec.add_development_dependency "httpx", "~> 0", "< 2.0.0"
# http 5.0 drop support of ruby 2.3 and 2.4. We still support those versions.
if RUBY_VERSION >= "2.5"
spec.add_development_dependency "http", "~> 5.0"
Expand Down
4 changes: 3 additions & 1 deletion lib/down/httpx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ class Httpx < Backend

USER_AGENT = "Down/#{Down::VERSION}"

BASIC_AUTH = HTTPX::VERSION >= "1.0.0" ? :basic_auth : :basic_authentication

def initialize(**options, &block)
@method = options.delete(:method) || :get
headers = options.delete(:headers) || {}
@client = HTTPX
.plugin(:follow_redirects, max_redirects: 2)
.plugin(:basic_authentication)
.plugin(BASIC_AUTH)
.plugin(:stream)
.with(
headers: { "user-agent": USER_AGENT }.merge(headers),
Expand Down
2 changes: 1 addition & 1 deletion test/httpx_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,4 @@
assert_raises(HTTPX::Error) { Down::Httpx.open("http://32r3ida") }
end
end
end
end

0 comments on commit e90927d

Please sign in to comment.