Class: Faraday::Adapter::Excon
- Inherits:
-
Faraday::Adapter
- Object
- Middleware
- Faraday::Adapter
- Faraday::Adapter::Excon
- Defined in:
- lib/faraday/adapter/excon.rb
Constant Summary
Constants inherited from Faraday::Adapter
Instance Attribute Summary
Attributes included from Parallelism
Instance Method Summary collapse
Methods inherited from Faraday::Adapter
#prepend_proxy_auth_string, #save_response
Methods included from Faraday::AutoloadHelper
#all_loaded_constants, #autoload_all, #load_autoloaded_constants
Methods included from MiddlewareRegistry
#lookup_middleware, #register_middleware
Methods included from Parallelism
#inherited, #supports_parallel?
Methods inherited from Middleware
dependency, inherited, #initialize, loaded?, new
Constructor Details
This class inherits a constructor from Faraday::Middleware
Instance Method Details
#call(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/faraday/adapter/excon.rb', line 6 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 |