Log response only if status code is not "201 Created"

This commit is contained in:
Ivan Buiko 2015-10-18 00:57:17 +03:00
parent 049f9873af
commit 684c2048d7

View file

@ -101,7 +101,7 @@ module Agents
mo = interpolated(event)
begin
response = HTTParty.post(endpoint_for(mo['type']), body: payload_for(mo), headers: headers)
response.code == 201 ? log(response.body) : error(response.body)
error(response.body) if response.code != 201
rescue HTTParty::Error => e
error(e.message)
end