lib/nationbuilder/client.rb in nationbuilder-rb-1.2.2 vs lib/nationbuilder/client.rb in nationbuilder-rb-1.2.3

- old
+ new

@@ -101,23 +101,23 @@ end def classify_response_error(response) case when response.code == 429 - return NationBuilder::RateLimitedError.new(response.body) + NationBuilder::RateLimitedError.new(response.body) when response.code.to_s.start_with?('4') - return NationBuilder::ClientError.new(response.body) + NationBuilder::ClientError.new(response.body) when response.code.to_s.start_with?('5') - return NationBuilder::ServerError.new(response.body) + NationBuilder::ServerError.new(response.body) end end def parse_response_body(response) error = classify_response_error(response) raise error if error if response.header['Content-Type'].first != 'application/json' - return nil + return true end body = response.body.strip return {} if body.length == 0 return JSON.parse(body)