diff --git a/src/cmd/run.rs b/src/cmd/run.rs index 330a884..85f149a 100644 --- a/src/cmd/run.rs +++ b/src/cmd/run.rs @@ -298,7 +298,7 @@ fn get_json_values(root: &Value, query: &str) -> Result> { Ok(vec![result.take()]) } -fn display_body(text: &str, no_pager: bool) { +pub fn display_body(text: &str, no_pager: bool) { let v: serde_json::Result = serde_json::from_str(text); let text = match v { Ok(v) => format!("{}\n", serde_json::to_string_pretty(&v).unwrap()), diff --git a/src/cmd/show.rs b/src/cmd/show.rs index 446d2f0..a45a542 100644 --- a/src/cmd/show.rs +++ b/src/cmd/show.rs @@ -81,7 +81,8 @@ pub fn response(b: &Bastion, matches: &ArgMatches) -> Result<()> { if let Some(body) = rr.request_body() { println!("{}", " Request Body".bold()); println!(" =============="); - println!("{}\n", std::str::from_utf8(body).unwrap()); + super::run::display_body(std::str::from_utf8(body).unwrap(), true); + println!(); } } @@ -100,7 +101,8 @@ pub fn response(b: &Bastion, matches: &ArgMatches) -> Result<()> { if let Some(body) = rr.response_body() { println!("{}", " Response Body".bold()); println!(" ==============="); - println!("{}\n", std::str::from_utf8(body).unwrap()); + super::run::display_body(std::str::from_utf8(body).unwrap(), true); + println!(); } let extractions = rr.extractions();