summaryrefslogtreecommitdiff
path: root/lib/chef/http
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/http')
-rw-r--r--lib/chef/http/json_input.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/http/json_input.rb b/lib/chef/http/json_input.rb
index eaee96d88a..4cc1aa2e10 100644
--- a/lib/chef/http/json_input.rb
+++ b/lib/chef/http/json_input.rb
@@ -33,7 +33,7 @@ class Chef
def handle_request(method, url, headers = {}, data = false)
if data && should_encode_as_json?(headers)
- headers.delete_if { |key, _value| key.downcase == "content-type" }
+ headers.delete_if { |key, _value| key.casecmp("content-type").zero? }
headers["Content-Type"] = "application/json"
json_opts = {}
json_opts[:validate_utf8] = opts[:validate_utf8] if opts.has_key?(:validate_utf8)
@@ -64,7 +64,7 @@ class Chef
# ruby/Net::HTTP don't enforce capitalized headers (it normalizes them
# for you before sending the request), so we have to account for all
# the variations we might find
- requested_content_type = headers.find { |k, v| k.downcase == "content-type" }
+ requested_content_type = headers.find { |k, v| k.casecmp("content-type").zero? }
requested_content_type.nil? || requested_content_type.last.include?("json")
end