summaryrefslogtreecommitdiff
path: root/lib/chef/http
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-23 10:45:15 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-23 10:45:15 -0800
commit271d3e4f91e3d158c9112512ac75d0ca51fc928d (patch)
tree5beb5e5588db43ecac46f38725cabf5e573fd1d6 /lib/chef/http
parentaa7e0e05395823c66b30f1a810d1720aea3b6d72 (diff)
downloadchef-271d3e4f91e3d158c9112512ac75d0ca51fc928d.tar.gz
Autofixing new Perf cops in 0.37.2
6 Performance/Casecmp 18 Performance/Detect 1 Performance/RangeInclude 27 Performance/RedundantBlockCall 6 Performance/RedundantMatch 5 Performance/RedundantMerge 18 Performance/StringReplacement
Diffstat (limited to 'lib/chef/http')
-rw-r--r--lib/chef/http/authenticator.rb2
-rw-r--r--lib/chef/http/basic_client.rb2
-rw-r--r--lib/chef/http/remote_request_id.rb2
-rw-r--r--lib/chef/http/socketless_chef_zero_client.rb2
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb
index b5e28cf54d..84065bf816 100644
--- a/lib/chef/http/authenticator.rb
+++ b/lib/chef/http/authenticator.rb
@@ -47,7 +47,7 @@ class Chef
end
def handle_request(method, url, headers = {}, data = false)
- headers.merge!({ "X-Ops-Server-API-Version" => @api_version })
+ headers["X-Ops-Server-API-Version"] = @api_version
headers.merge!(authentication_headers(method, url, data, headers)) if sign_requests?
[method, url, headers, data]
end
diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb
index e0a02a05cf..58ae496418 100644
--- a/lib/chef/http/basic_client.rb
+++ b/lib/chef/http/basic_client.rb
@@ -104,7 +104,7 @@ class Chef
# proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy
# here since we are really just trying to get the string built correctly.
if String === proxy && !proxy.strip.empty?
- if proxy.match(/^.*:\/\//)
+ if proxy =~ /^.*:\/\//
proxy = URI.parse(proxy.strip)
else
proxy = URI.parse("#{url.scheme}://#{proxy.strip}")
diff --git a/lib/chef/http/remote_request_id.rb b/lib/chef/http/remote_request_id.rb
index ef8a18a1e3..a779df805e 100644
--- a/lib/chef/http/remote_request_id.rb
+++ b/lib/chef/http/remote_request_id.rb
@@ -25,7 +25,7 @@ class Chef
end
def handle_request(method, url, headers = {}, data = false)
- headers.merge!({ "X-REMOTE-REQUEST-ID" => Chef::RequestID.instance.request_id })
+ headers["X-REMOTE-REQUEST-ID"] = Chef::RequestID.instance.request_id
[method, url, headers, data]
end
diff --git a/lib/chef/http/socketless_chef_zero_client.rb b/lib/chef/http/socketless_chef_zero_client.rb
index c8590903f6..e25242c033 100644
--- a/lib/chef/http/socketless_chef_zero_client.rb
+++ b/lib/chef/http/socketless_chef_zero_client.rb
@@ -67,7 +67,7 @@ class Chef
end
if block_given?
- block.call(@body)
+ yield(@body)
else
super
end