lib/grape/batch/response.rb in grape-batch-2.0.1 vs lib/grape/batch/response.rb in grape-batch-2.1.0

- old
+ new

@@ -1,22 +1,10 @@ class Grape::Batch::Response - def self.format(status, headers, response, env) + def self.format(status, headers, response) if response body = response.respond_to?(:body) ? response.body.join : response.join - parsing_failed = true - - begin - result = MultiJson.decode(body) - parsing_failed = false - rescue MultiJson::ParseError - # Captain planet to the rescue - end + result = MultiJson.decode(body) end - if parsing_failed || result.empty? - status = 404 - result = { 'error' => "#{env['PATH_INFO']} not found" } - end - - (200..299).include?(status) ? { success: result } : { code: status, error: result['error'] } + (200..299).include?(status) ? {success: result} : {code: status, error: result['error']} end end