summaryrefslogtreecommitdiff
path: root/lib/chef/http
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-03-04 11:13:26 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-03-04 11:13:26 -0800
commit6ec521c0b86c266b9dd5d17a6060139dab404c3b (patch)
treea27bf7a007bfeebd64258c2e5652f6da37b73efc /lib/chef/http
parentee53ee1aba16ee2ad7c1fdde18869af971dcba67 (diff)
parent4fd88f1f3c7d847712e61abab2bac6cb4a987265 (diff)
downloadchef-6ec521c0b86c266b9dd5d17a6060139dab404c3b.tar.gz
Merge pull request #4617 from chef/lcg/chefstyle-perf
Autofixing new Perf cops in 0.37.2
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.rb5
4 files changed, 6 insertions, 5 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..8c1578b976 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
@@ -148,7 +148,8 @@ class Chef
@url.port
end
- def request(method, url, body, headers, &handler_block)
+ # FIXME: yard with @yield
+ def request(method, url, body, headers)
request = req_to_rack(method, url, body, headers)
res = ChefZero::SocketlessServerMap.request(port, request)