summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortylercloke <tylercloke@gmail.com>2015-04-30 15:06:17 -0700
committertylercloke <tylercloke@gmail.com>2015-05-04 13:18:30 -0700
commitddf2135f147eca68490829dd96c65690c27f8d04 (patch)
tree50d01383e922c208625cb5ffa8c47855ccad71c0 /lib
parentc6c7329ff54851390e0e84d0b681ee8396b3f34c (diff)
downloadchef-ddf2135f147eca68490829dd96c65690c27f8d04.tar.gz
Implemented X-Ops-Server-API-Version in Chef requests.
This takes advantage of Chef::HTTP::Authenticator.handle_request. After the authentication_headers have been merged, it adds: {'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::SERVER_API_VERSION} Chef::HTTP::Authenticator::SERVER_API_VERSION should corrospond to the max version of the server the client is compatible with. We are starting at "0". I also removed outer level lets :base_header and :req_with_body_headers from rest_spec.rb as they were never used anywhere. Another :base_header was defined in a tighter part of the spec and was only used in that scope, and :req_with_body_headers was never used anywhere.
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/http/authenticator.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb
index 4255f18cbd..4ec35add34 100644
--- a/lib/chef/http/authenticator.rb
+++ b/lib/chef/http/authenticator.rb
@@ -24,6 +24,8 @@ class Chef
class HTTP
class Authenticator
+ SERVER_API_VERSION = "0"
+
attr_reader :signing_key_filename
attr_reader :raw_key
attr_reader :attr_names
@@ -41,6 +43,7 @@ class Chef
def handle_request(method, url, headers={}, data=false)
headers.merge!(authentication_headers(method, url, data)) if sign_requests?
+ headers.merge!({'X-Ops-Server-API-Version' => SERVER_API_VERSION})
[method, url, headers, data]
end