bin/check-http-json.rb in sensu-plugins-http-2.0.0 vs bin/check-http-json.rb in sensu-plugins-http-2.0.1
- old
+ new
@@ -90,11 +90,11 @@
when Array
data.each_with_index do |value, index|
arr_key = parent + '[' + index.to_s + ']'
if arr_key == desired_key
- return value
+ return value.nil? ? 'null' : value
end
if desired_key.include? arr_key
search = deep_value(value, desired_key, arr_key)
@@ -105,10 +105,10 @@
data.each do |key, value|
key_prefix = parent.empty? ? '' : '.'
hash_key = parent + key_prefix + key
if hash_key == desired_key
- return value
+ return value.nil? ? 'null' : value
end
if desired_key.include?(hash_key + '.') || desired_key.include?(hash_key + '[')
search = deep_value(value, desired_key, hash_key)