1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Handle json parsing errors and fall back to inspect for CLI

This commit is contained in:
John Nunemaker 2017-04-21 10:09:43 -04:00
parent 762bb6b056
commit 60aa11a8bb
No known key found for this signature in database
GPG key ID: D80B5604D6DC62E0

View file

@ -103,9 +103,11 @@ else
when :json
begin
require 'json'
puts JSON.pretty_generate(response)
puts JSON.pretty_generate(response.parsed_response)
rescue LoadError
puts YAML.dump(response)
rescue JSON::JSONError
puts response.inspect
end
when :xml
require 'rexml/document'