diff --git a/lib/slack/web/faraday/response/raise_error.rb b/lib/slack/web/faraday/response/raise_error.rb index e7989f0c..140ab7b3 100644 --- a/lib/slack/web/faraday/response/raise_error.rb +++ b/lib/slack/web/faraday/response/raise_error.rb @@ -20,15 +20,16 @@ def response_content_type_is_a_string?(env) def should_return?(env) body = env.body - (env.success? && body.is_a?(String) && response_content_type_is_a_string?(env)) || !body || body['ok'] + return true if !env.success? + return true if env.success? && body.is_a?(String) && response_content_type_is_a_string?(env) + return true if !body || body['ok'] + return false end def on_complete(env) throw_if_too_many_requests(env) throw_if_response_is_invalid_json(env) - return unless env.success? - body = env.body return if should_return?(env)