Methods

Faraday::Adapter::Excon

Public Instance Methods

call(env) click to toggle source
# File lib/faraday/adapter/excon.rb, line 6
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

[Validate]

Generated with the Darkfish Rdoc Generator 2.