Module: RubyProxyHeaders::RestClient::NetHttpHook

Defined in:
lib/ruby_proxy_headers/rest_client.rb

Overview

Sets CONNECT headers on the Net::HTTP object RestClient is about to use.

Instance Method Summary collapse

Instance Method Details

#net_http_object(hostname, port) ⇒ Object



29
30
31
32
33
34
# File 'lib/ruby_proxy_headers/rest_client.rb', line 29

def net_http_object(hostname, port)
  http = super
  headers = Thread.current[:ruby_proxy_headers_rest_client_headers]
  http.proxy_connect_request_headers = headers if headers&.any?
  http
end