diff --git a/bamboozled.gemspec b/bamboozled.gemspec index 590b14f..c2200d5 100644 --- a/bamboozled.gemspec +++ b/bamboozled.gemspec @@ -26,5 +26,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "webmock", "~> 1.20" spec.add_dependency "httparty", "~> 0.13" - spec.add_dependency "json", "~> 1.8" + spec.add_dependency "json", ">= 1.8" end diff --git a/lib/bamboozled/api/base.rb b/lib/bamboozled/api/base.rb index ae950b7..25e39eb 100644 --- a/lib/bamboozled/api/base.rb +++ b/lib/bamboozled/api/base.rb @@ -37,10 +37,11 @@ def request(method, path, options = {}) case response.code when 200..201 begin - if response.body.to_s.empty? + body = response.body.to_s + if body.empty? { "headers" => response.headers } else - JSON.parse(response) + JSON.parse(body) end rescue typecast = options.fetch(:typecast_values, true)