lib/putio/client.rb in putio-cli-0.0.4 vs lib/putio/client.rb in putio-cli-0.0.5
- old
+ new
@@ -477,11 +477,11 @@
response = Curl.post(url, postdata) { |req| req.headers['Accept'] = 'application/json' }
else
response = Curl.get(url) { |req| req.headers['Accept'] = 'application/json' }
end
- # Use Crack to parse the JSON
+ # Natively parse the JSON
response = JSON::parse(response.body_str)
# And use Hashie to present it.
response = Hashie::Mash.new(response)
end
@@ -518,16 +518,12 @@
response = Curl::Easy.new(url)
response.multipart_form_post = true
response.headers['Accept'] = 'application/json'
response.http_post(Curl::PostField.file('file', file))
- # Use Crack to parse the JSON
- begin
- response = Crack::JSON.parse(response.body_str)
- rescue Psych::SyntaxError
- response = JSON::parse(response.body_str)
- end
-
+ # Natively parse the JSON
+ response = JSON::parse(response.body_str)
+
# And use Hashie to present it.
response = Hashie::Mash.new(response)
end
end