34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/chef/http/json_input.rb', line 34
def handle_request(method, url, = {}, data = false)
if data && should_encode_as_json?()
.delete_if { |key, _value| key.casecmp("content-type") == 0 }
["Content-Type"] = "application/json"
json_opts = {}
json_opts[:validate_utf8] = opts[:validate_utf8] if opts.key?(:validate_utf8)
data = Chef::JSONCompat.to_json(data, json_opts)
data.force_encoding(Encoding::BINARY) if data.respond_to?(:force_encoding)
end
[method, url, , data]
end
|