Skip to content

Commit

Permalink
Merge da8a179 into 7a444d8
Browse files Browse the repository at this point in the history
  • Loading branch information
brandur committed Nov 14, 2018
2 parents 7a444d8 + da8a179 commit 3ea5920
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
17 changes: 12 additions & 5 deletions lib/stripe/stripe_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ def self.default_conn
# of connection re-use, so make sure that we have a separate connection
# object per thread.
Thread.current[:stripe_client_default_conn] ||= begin
conn = Faraday.new do |c|
c.use Faraday::Request::Multipart
c.use Faraday::Request::UrlEncoded
c.use Faraday::Response::RaiseError
c.adapter Faraday.default_adapter
conn = Faraday.new do |builder|
builder.use Faraday::Request::Multipart
builder.use Faraday::Request::UrlEncoded
builder.use Faraday::Response::RaiseError

# Net::HTTP::Persistent doesn't seem to do well on JRuby, so fall
# back to default there.
if RUBY_PLATFORM == "java"
builder.adapter :net_http
else
builder.adapter :net_http_persistent
end
end

if Stripe.verify_ssl_certs
Expand Down
1 change: 1 addition & 0 deletions stripe.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Gem::Specification.new do |s|
s.license = "MIT"

s.add_dependency("faraday", "~> 0.10")
s.add_dependency("net-http-persistent", "~> 3.0")

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test/*`.split("\n")
Expand Down
3 changes: 2 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
# we can print one error and fail fast so that it's more clear to the user how
# they should fix the problem.
begin
resp = Faraday.get("http://localhost:#{MOCK_PORT}/")
conn = Faraday::Connection.new("http://localhost:#{MOCK_PORT}")
resp = conn.get("/")
version = resp.headers["Stripe-Mock-Version"]
if version != "master" &&
Gem::Version.new(version) < Gem::Version.new(MOCK_MINIMUM_VERSION)
Expand Down

0 comments on commit 3ea5920

Please sign in to comment.