Module: Faraday::Adapter::NetHttp

Extended by:
Connection::Options
Defined in:
lib/faraday/adapter/net_http.rb

Instance Method Summary collapse

Methods included from Connection::Options

load_error, load_error=, loaded?, supports_async, supports_async=

Instance Method Details

#_get(uri, request_headers) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/faraday/adapter/net_http.rb', line 7

def _get(uri, request_headers)
  http = Net::HTTP.new(uri.host, uri.port)
  response_class.new do |resp|
    http_resp = http.get(path_for(uri), request_headers) do |chunk|
      resp.process(chunk)
    end
    http_resp.each_header do |key, value|
      resp.headers[key] = value
    end
  end
rescue Errno::ECONNREFUSED
  raise Faraday::Error::ConnectionFailed, "connection refused"
end