lib/googleajax/api.rb in googleajax-1.0.0 vs lib/googleajax/api.rb in googleajax-1.0.1

- old
+ new

@@ -24,10 +24,14 @@ data = yield data if block_given? # Convert hashes to an instance of ourself from this data: Filters::Recursive.remap(data, self) end + LOOKS_LIKE_HTML = /\w*<html>/i def parse(data) + if data =~ LOOKS_LIKE_HTML + raise StandardError, /<title>(.*)<\/title>/.match(data)[1] + end if defined? Rails ActiveSupport::JSON::decode(data) else JSON.parse(data) end