diff options
Diffstat (limited to 'lib/chef/http/json_input.rb')
-rw-r--r-- | lib/chef/http/json_input.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/chef/http/json_input.rb b/lib/chef/http/json_input.rb index 2fd1501b1d..ae2c0ac2b7 100644 --- a/lib/chef/http/json_input.rb +++ b/lib/chef/http/json_input.rb @@ -21,17 +21,15 @@ require "chef/json_compat" class Chef class HTTP - # Middleware that takes json input and turns it into raw text class JSONInput - attr_accessor :opts - def initialize(opts={}) + def initialize(opts = {}) @opts = opts end - def handle_request(method, url, headers={}, data=false) + 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["Content-Type"] = "application/json" @@ -64,10 +62,9 @@ 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.downcase == "content-type" } requested_content_type.nil? || requested_content_type.last.include?("json") end - end end end |