Skip to content

Commit

Permalink
Support httprb 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Guo committed Jan 22, 2019
1 parent 37be629 commit 40aa9ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/wechat/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ class HttpClient

def initialize(base, timeout, skip_verify_ssl)
@base = base
@httprb = HTTP.timeout(:global, write: timeout, connect: timeout, read: timeout)
@httprb = if HTTP::VERSION.to_i >= 4
HTTP.timeout(write: timeout, connect: timeout, read: timeout)
else
HTTP.timeout(:global, write: timeout, connect: timeout, read: timeout)
end
@ssl_context = OpenSSL::SSL::SSLContext.new
@ssl_context.ssl_version = :TLSv1
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE if skip_verify_ssl
Expand Down
2 changes: 1 addition & 1 deletion wechat.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME.end_with?('gem')

s.add_runtime_dependency 'activesupport', '>= 3.2', '< 6'
s.add_runtime_dependency 'http', '>= 1.0.4', '< 4'
s.add_runtime_dependency 'http', '>= 1.0.4', '< 5'
s.add_runtime_dependency 'nokogiri', '>=1.6.0'
s.add_runtime_dependency 'thor'
s.add_development_dependency 'rails', '>= 5.1'
Expand Down

0 comments on commit 40aa9ee

Please sign in to comment.