lib/inbox.rb in nylas-0.16.1 vs lib/inbox.rb in nylas-0.17.0

- old
+ new

@@ -34,10 +34,10 @@ # Handle HTTP errors Inbox.interpret_http_status(result) # Handle content expectation errors raise UnexpectedResponse.new if options[:expected_class] && result_content.empty? - json = JSON.parse(result_content) + json = options[:result_parsed]? result_content : JSON.parse(result_content) if json.is_a?(Hash) && (json['type'] == 'api_error' or json['type'] == 'invalid_request_error') if result.code.to_i == 400 exc = InvalidRequest elsif result.code.to_i == 402 exc = MessageRejected