Sha256: d27c39ceac4c34ffccb110ade4d5f3c9a84673585c79e141a23a5e5dc2289812

Contents?: true

Size: 731 Bytes

Versions: 10

Compression:

Stored size: 731 Bytes

Contents

module Faraday
  class Adapter
    class Excon < Faraday::Adapter
      dependency 'excon'

      def call(env)
        super

        conn = ::Excon.new(env[:url].to_s)
        if ssl = (env[:url].scheme == 'https' && env[:ssl])
          ::Excon.ssl_verify_peer = !!ssl.fetch(:verify, true)
          ::Excon.ssl_ca_path = ssl[:ca_file] if ssl[:ca_file]
        end

        resp = conn.request \
          :method  => env[:method].to_s.upcase,
          :headers => env[:request_headers],
          :body    => env[:body]

        save_response(env, resp.status.to_i, resp.body, resp.headers)

        @app.call env
      rescue ::Excon::Errors::SocketError
        raise Error::ConnectionFailed, $!
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
faraday-0.8.0 lib/faraday/adapter/excon.rb
faraday-0.8.0.rc2 lib/faraday/adapter/excon.rb
faraday-0.7.6 lib/faraday/adapter/excon.rb
faraday-0.7.5 lib/faraday/adapter/excon.rb
faraday-0.7.4 lib/faraday/adapter/excon.rb
faraday-0.7.3 lib/faraday/adapter/excon.rb
faraday-0.7.2 lib/faraday/adapter/excon.rb
faraday-0.7.1 lib/faraday/adapter/excon.rb
faraday-0.7.0 lib/faraday/adapter/excon.rb
faraday-0.6.1 lib/faraday/adapter/excon.rb