diff --git a/CHANGELOG.md b/CHANGELOG.md index 59bf1367..dafacc5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added `FetchCanisterLogs` function to `MgmtMethod` and a corresponding wrapper to `ManagementCanister`. * Updated the `ring` crate to 0.17.7. `ring` 0.16 has a bug where it requires incorrect Ed25519 PEM encoding. 0.17.7 fixes that and is backwards compatible. * Removed serde and candid serialization traits from the `Status` type. +* Added commas and newlines to the `Status` fmt::Display output. It is valid JSON now (it was close before). ## [0.33.0] - 2024-02-08 diff --git a/ic-agent/src/agent/status.rs b/ic-agent/src/agent/status.rs index ef49be0b..60f78203 100644 --- a/ic-agent/src/agent/status.rs +++ b/ic-agent/src/agent/status.rs @@ -58,7 +58,13 @@ pub struct Status { impl std::fmt::Display for Status { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("{\n")?; + let mut first = true; for (key, value) in &self.values { + if first { + first = false; + } else { + f.write_str(",\n")?; + } f.write_fmt(format_args!(r#" "{}": "#, key.escape_debug()))?; std::fmt::Display::fmt(&value, f)?; }