Commit 4521ffb4 authored by Daniel DeLeo's avatar Daniel DeLeo
Browse files

change the color of the UA bikeshed

parent 629a1b42
......@@ -23,13 +23,17 @@
require 'uri'
require 'net/http'
require 'chef/rest/cookie_jar'
require 'ohai' #used in user agent string.
require 'chef/version'
class Chef
class REST
class RESTRequest
DEFAULT_UA = "chef-client #{::Chef::VERSION}"
engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
UA_COMMON = "/#{::Chef::VERSION} (#{engine}-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}; ohai-#{Ohai::VERSION}; #{RUBY_PLATFORM}; +http://opscode.com)"
DEFAULT_UA = "Chef Client" << UA_COMMON
def self.user_agent=(ua)
@user_agent = ua
......
......@@ -339,7 +339,7 @@ describe Chef::REST do
it "sets the user agent to chef-client" do
@rest.api_request(:GET, @url, {})
@request_mock['User-Agent'].should == "chef-client #{Chef::VERSION}"
@request_mock['User-Agent'].should match /^Chef Client\/#{Chef::VERSION}/
end
it "should set the cookie for this request if one exists for the given host:port" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment