mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
added test for connection coalescing (and removed the certificate verification disable flag)
This commit is contained in:
parent
d0587563a6
commit
8ca59545a2
@ -23,6 +23,22 @@ class HTTPSTest < Minitest::Test
|
||||
include Plugins::Retries
|
||||
include Plugins::Multipart
|
||||
|
||||
def test_connection_coalescing
|
||||
coalesced_origin = "https://#{ENV["HTTPBIN_COALESCING_HOST"]}"
|
||||
HTTPX.wrap do |http|
|
||||
response1 = http.get(origin)
|
||||
verify_status(response1, 200)
|
||||
response2 = http.get(coalesced_origin)
|
||||
verify_status(response2, 200)
|
||||
# introspection time
|
||||
pool = http.__send__(:pool)
|
||||
connections = pool.instance_variable_get(:@connections)
|
||||
assert connections.any? { |conn|
|
||||
conn.instance_variable_get(:@origins) == [origin, coalesced_origin]
|
||||
}, "connections didn't coalesce (expected connection with both origins)"
|
||||
end
|
||||
end if ENV.key?("HTTPBIN_COALESCING_HOST")
|
||||
|
||||
private
|
||||
|
||||
def origin(orig = httpbin)
|
||||
|
@ -14,9 +14,5 @@ end
|
||||
|
||||
require "httpx"
|
||||
|
||||
# TODO: remove this once ruby 2.5 bug is fixed:
|
||||
# https://github.com/ruby/openssl/issues/187
|
||||
ENV["CI"] && OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:verify_mode] = 0
|
||||
|
||||
Dir[File.join(".", "test", "support", "*.rb")].each { |f| require f }
|
||||
Dir[File.join(".", "test", "support", "**", "*.rb")].each { |f| require f }
|
||||
|
Loading…
x
Reference in New Issue
Block a user