Skip to content

Commit

Permalink
Pretty print config (#652)
Browse files Browse the repository at this point in the history
* Pretty print config

* Fix tests

* Lint
  • Loading branch information
Steven Jin authored Aug 11, 2023
1 parent 30159a0 commit 66a5516
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ async fn handle_config_dump(
}
}

let vec = serde_json::to_vec(&dump).unwrap();
let body = serde_json::to_string_pretty(&dump).unwrap();
Response::builder()
.status(hyper::StatusCode::OK)
.body(vec.into())
.body(body.into())
.unwrap()
}

Expand Down Expand Up @@ -812,9 +812,12 @@ mod tests {
// the config dump at all from our internal types
assert!(resp_str.contains("defaultnw/127.0.0.2"));
// Check a waypoint
assert!(
resp_str.contains(r#"waypoint":{"destination":"defaultnw/127.0.0.10","port":15008}"#)
);
assert!(resp_str.contains(
r#"waypoint": {
"destination": "defaultnw/127.0.0.10",
"port": 15008
}"#
));
}

// each of these tests assert that we can change the log level and the
Expand Down

0 comments on commit 66a5516

Please sign in to comment.