fix: should also work when it's not json
This commit is contained in:
parent
afda46073a
commit
359b77b5aa
1 changed files with 5 additions and 1 deletions
|
@ -169,7 +169,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
if args.verbose {
|
||||
let mut body = response.text().await?;
|
||||
if pretty {
|
||||
body = serde_json::to_string_pretty(&serde_json::from_str::<serde_json::Value>(&body)?)?;
|
||||
if let Ok(v) = serde_json::from_str::<serde_json::Value>(&body) {
|
||||
if let Ok(t) = serde_json::to_string_pretty(&v) {
|
||||
body = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
println!(" │ {}", body.replace("\n", "\n │ "));
|
||||
println!(" │");
|
||||
|
|
Loading…
Reference in a new issue