Skip to content

Commit 63586c6

Browse files
Eric-Guohophacker
authored andcommitted
Support httprb 4.0
httprb/http#446
1 parent cef1da7 commit 63586c6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/wechat/http_client.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ class HttpClient
66

77
def initialize(base, timeout, skip_verify_ssl)
88
@base = base
9-
@httprb = HTTP.timeout(:global, write: timeout, connect: timeout, read: timeout)
9+
@httprb = if HTTP::VERSION.to_i >= 4
10+
HTTP.timeout(write: timeout, connect: timeout, read: timeout)
11+
else
12+
HTTP.timeout(:global, write: timeout, connect: timeout, read: timeout)
13+
end
1014
@ssl_context = OpenSSL::SSL::SSLContext.new
1115
@ssl_context.ssl_version = :TLSv1
1216
@ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE if skip_verify_ssl

wechat.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
1919
s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME.end_with?('gem')
2020

2121
s.add_runtime_dependency 'activesupport', '>= 3.2', '< 6'
22-
s.add_runtime_dependency 'http', '>= 1.0.4', '< 4'
22+
s.add_runtime_dependency 'http', '>= 1.0.4', '< 5'
2323
s.add_runtime_dependency 'nokogiri', '>=1.6.0'
2424
s.add_runtime_dependency 'thor'
2525
s.add_development_dependency 'rails', '>= 5.1'

0 commit comments

Comments
 (0)