def call(env)
super
http = net_http_connection(env)
configure_ssl(http, env[:ssl]) if env[:url].scheme == 'https' and env[:ssl]
req = env[:request]
http.read_timeout = http.open_timeout = req[:timeout] if req[:timeout]
http.open_timeout = req[:open_timeout] if req[:open_timeout]
begin
http_response = perform_request(http, env)
rescue *NET_HTTP_EXCEPTIONS
raise Error::ConnectionFailed, $!
end
save_response(env, http_response.code.to_i, http_response.body) do |response_headers|
http_response.each_header do |key, value|
response_headers[key] = value
end
end
@app.call env
rescue Timeout::Error => err
raise Faraday::Error::TimeoutError, err
end