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:
parent
762bb6b056
commit
60aa11a8bb
1 changed files with 3 additions and 1 deletions
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue