lib/cc/cli/version_checker.rb in codeclimate-0.62.0 vs lib/cc/cli/version_checker.rb in codeclimate-0.63.0

- old
+ new

@@ -63,12 +63,16 @@ def http_response @http_response ||= begin uri = URI.parse(ENV.fetch("CODECLIMATE_VERSIONS_URL", DEFAULT_VERSIONS_URL)) uri.query = { version: version, uid: global_config.uuid }.to_query + + request = Net::HTTP::Get.new(uri) + request["User-Agent"] = user_agent + Net::HTTP.start(uri.host, uri.port, open_timeout: 5, read_timeout: 5, ssl_timeout: 5, use_ssl: uri.scheme == "https") do |http| - http.request_get(uri) + http.request(request) end end end def cache!(data) @@ -78,9 +82,13 @@ data end def version @version ||= Version.new.version + end + + def user_agent + "Code Climate CLI #{version}" end def global_config @global_config ||= GlobalConfig.new end