class Chef::HTTP::APIVersions

An HTTP middleware to retrieve and store the Chef Server’s minimum and maximum supported API versions.

Public Class Methods

new(options = {}) click to toggle source
# File lib/chef/http/api_versions.rb, line 27
def initialize(options = {}); end

Public Instance Methods

handle_request(method, url, headers = {}, data = false) click to toggle source
# File lib/chef/http/api_versions.rb, line 29
def handle_request(method, url, headers = {}, data = false)
  [method, url, headers, data]
end
handle_response(http_response, rest_request, return_value) click to toggle source
# File lib/chef/http/api_versions.rb, line 33
def handle_response(http_response, rest_request, return_value)
  if http_response.code == "406"
    ServerAPIVersions.instance.reset!
  end
  if http_response.key?("x-ops-server-api-version")
    ServerAPIVersions.instance.set_versions(JSONCompat.parse(http_response["x-ops-server-api-version"]))
  else
    ServerAPIVersions.instance.unversioned!
  end
  [http_response, rest_request, return_value]
end
handle_stream_complete(http_response, rest_request, return_value) click to toggle source
# File lib/chef/http/api_versions.rb, line 49
def handle_stream_complete(http_response, rest_request, return_value)
  [http_response, rest_request, return_value]
end
stream_response_handler(response) click to toggle source
# File lib/chef/http/api_versions.rb, line 45
def stream_response_handler(response)
  nil
end