From 29dce5904313965a5c5e41831dd3c2c8455b1879 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Fri, 4 Aug 2017 21:05:28 +0900 Subject: [PATCH] Cast HTTP response body for JSON to string (regression from #4) (#5) Oj uses `readpartial` instead of `to_s` if the value given for the arguments has a `readpartial` method. Also, HTTP.rb splits the response if `Transfer-Encoding: chunked` is returned in the HTTP headers. Will use `to_s` like `JSON.parse` which was used previously. --- lib/goldfinger/result.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/goldfinger/result.rb b/lib/goldfinger/result.rb index 6eec64d..5173c7b 100644 --- a/lib/goldfinger/result.rb +++ b/lib/goldfinger/result.rb @@ -74,7 +74,7 @@ module Goldfinger end def parse_json - json = Oj.load(@body, mode: :null) + json = Oj.load(@body.to_s, mode: :null) @subject = json['subject'] @aliases = json['aliases'] || []