summaryrefslogtreecommitdiffstats
path: root/src/json.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-01-25 14:16:35 +0100
committerPhil Sutter <phil@nwl.cc>2021-01-27 17:21:25 +0100
commit5789da3b729f5e3724aeecdcec1a44476659ed03 (patch)
tree9253fdf386624c9af431df1ba2de44f9148b4e9f /src/json.c
parent7ca3368cd7575e710114fc60e8ecc8ffba95154d (diff)
json: limit: Always include burst value
The default burst value is non-zero, so JSON output should include it. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/json.c b/src/json.c
index 585d3532..83717141 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1168,19 +1168,17 @@ json_t *limit_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
burst_unit = get_rate(stmt->limit.burst, &burst);
}
- root = json_pack("{s:I, s:s}",
+ root = json_pack("{s:I, s:I, s:s}",
"rate", rate,
+ "burst", burst,
"per", get_unit(stmt->limit.unit));
if (inv)
json_object_set_new(root, "inv", json_boolean(inv));
if (rate_unit)
json_object_set_new(root, "rate_unit", json_string(rate_unit));
- if (burst && burst != 5) {
- json_object_set_new(root, "burst", json_integer(burst));
- if (burst_unit)
- json_object_set_new(root, "burst_unit",
- json_string(burst_unit));
- }
+ if (burst_unit)
+ json_object_set_new(root, "burst_unit",
+ json_string(burst_unit));
return json_pack("{s:o}", "limit", root);
}