Class: Faraday::Adapter::NetHttpNoProxy

Inherits:
NetHttp
  • Object
show all
Defined in:
lib/faraday/adapter/net_http_no_proxy.rb

Instance Method Summary collapse

Instance Method Details

#net_http_connection(env) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/faraday/adapter/net_http_no_proxy.rb', line 4

def net_http_connection(env)
  # Monkey Patch, never use the request to set the proxy settings, let Net::HTTP figure out by itself from
  # the environment variables

  # Original code:
  # if proxy = env[:request][:proxy]
  #   Net::HTTP::Proxy(proxy[:uri].host, proxy[:uri].port, proxy[:user], proxy[:password])
  # else
  #   Net::HTTP
  # end.new(env[:url].host, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80))

  Net::HTTP.new(env[:url].host, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80))
end