Sha256: 229261c7819fed20bebf6227550e48c23590e3b386b66224296b9eac9296608c

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

module Faraday
  class Adapter
    class SemaphoreNetHttp < NetHttp
      def net_http_connection(env)
        connections = (Thread.current[:net_http_connections] ||= {})
        env_key = [env.url.host, env.url.port, env.ssl.verify]
        connections[env_key] ||= begin
                                   super(env).tap { |connection|
                                     # uncomment to enable Net::HTTP debugging
                                     # connection.set_debug_output($stderr)
                                     connection.use_ssl = true
                                     connection.start
                                   }
                                 end
      end
    end

    register_middleware semaphore_net_http: SemaphoreNetHttp
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git-semaphore-3.1.0 lib/ext/faraday.rb
git-semaphore-3.0.0 lib/ext/faraday.rb