Sha256: febcccc089d047a821b851935015697ab171c3f18b32cb0b1c83d145ff3a0ad1

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

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

      def call(env)
        super

        conn = ::Excon.new(env[:url].to_s)
        if env[:url].scheme == 'https' && ssl = 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

1 entries across 1 versions & 1 rubygems

Version Path
faraday-0.8.1 lib/faraday/adapter/excon.rb