Skip to content

Commit

Permalink
HTTParty will no longer override response#nil?
Browse files Browse the repository at this point in the history
Get rid off the DEPRECATED warning in related to that functionality..

==> graylog: [DEPRECATION] HTTParty will no longer override `response#nil?`. This functionality will be removed in future versions. Please, add explicit check `response.body.nil? || response.body.empty?`. For more info refer to: jnunemaker/httparty#568
==> graylog: /tmp/vagrant-puppet/environments/local/local-modules/graylog_api/lib/puppet/provider/graylog_api.rb:109:in `request'
==> graylog: [DEPRECATION] HTTParty will no longer override `response#nil?`. This functionality will be removed in future versions. Please, add explicit check `response.body.nil? || response.body.empty?`. For more info refer to: jnunemaker/httparty#568
  • Loading branch information
tahder authored Dec 19, 2024
1 parent 661fb48 commit a6ecf7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/graylog_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def request(method, path, params = {})
**tls_opts
)

if result.body
if result.body && !result.body.empty?
if result.body.include? '"type":"ApiError"'
Puppet.send_log(:err, "Got error response #{result.body}")
raise
Expand All @@ -106,7 +106,7 @@ def request(method, path, params = {})
Puppet.send_log(:err, "Got error response #{e.response}")
raise e
end
recursive_nil_to_undef(JSON.parse(result.body)) unless result.nil?
recursive_nil_to_undef(JSON.parse(result.body)) if result.body && !result.body.empty?
end

# Under Puppet Apply, undef in puppet-lang becomes :undef instead of nil
Expand Down

0 comments on commit a6ecf7e

Please sign in to comment.