Method: Chef::HTTP#initialize

Defined in:
lib/chef/http.rb

#initialize(url, options = {}) ⇒ HTTP

Create a HTTP client object. The supplied url is used as the base for all subsequent requests. For example, when initialized with a base url localhost:4000, a call to get with ‘nodes’ will make an HTTP GET request to localhost:4000/nodes



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/chef/http.rb', line 92

def initialize(url, options = {})
  @url = url
  @default_headers = options[:headers] || {}
  @sign_on_redirect = true
  @redirects_followed = 0
  @redirect_limit = 10
  @keepalives = options[:keepalives] || false
  @options = options
  @nethttp_opts = options[:nethttp] || {}

  @middlewares = []
  self.class.middlewares.each do |middleware_class|
    @middlewares << middleware_class.new(options)
  end
end