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 Method Summary collapse
Methods inherited from Faraday::Adapter
Methods included from Faraday::AutoloadHelper
#all_loaded_constants, #autoload_all, #load_autoloaded_constants, #lookup_module, #register_lookup_modules
Methods inherited from Middleware
dependency, #initialize, loaded?, setup_parallel_manager
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 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 |