lib/globase/base.rb in globase-0.0.2 vs lib/globase/base.rb in globase-0.0.3
- old
+ new
@@ -92,11 +92,12 @@
def base_url(parent = nil)
"#{host_url}/#{collection_name}"
end
def parse(body)
- JSON.parse(body)
+ return unless body.present?
+ JSON.parse(body.to_s.force_encoding("UTF-8"))
end
def timeout
Globase.config.timeout
end
@@ -150,15 +151,16 @@
puts "#{'*'*80}"
puts " Response"
puts "#{'*'*80}"
puts " code: #{response.code}"
puts " headers: #{response.headers.inspect}"
- puts " body: #{response.body}"
+ puts " body encoding: #{response.body.to_s.encoding}"
+ puts " body: #{response.body.to_s.force_encoding("UTF-8")}"
puts "#{'*'*80}\n"
end
end
end
end
-end
\ No newline at end of file
+end