Skip to content

Commit be4dd02

Browse files
authored
Omit empty for error and error types (#5954)
1 parent 1b7a5e0 commit be4dd02

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* [ENHANCEMENT] Distributor/Ring: Allow disabling detailed ring metrics by ring member. #5931
1010
* [ENHANCEMENT] KV: Etcd Added etcd.ping-without-stream-allowed parameter to disable/enable PermitWithoutStream #5933
1111
* [CHANGE] Upgrade Dockerfile Node version from 14x to 18x. #5906
12-
* [CHANGE] Query Frontend/Ruler: Omit empty data field in API response. #5953
12+
* [CHANGE] Query Frontend/Ruler: Omit empty data field in API response. #5953 #5954
1313
* [BUGFIX] Configsdb: Fix endline issue in db password. #5920
1414
* [BUGFIX] Ingester: Fix `user` and `type` labels for the `cortex_ingester_tsdb_head_samples_appended_total` TSDB metric. #5952
1515

pkg/ruler/api_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func TestRuler_DeleteNamespace(t *testing.T) {
337337

338338
router.ServeHTTP(w, req)
339339
require.Equal(t, http.StatusAccepted, w.Code)
340-
require.Equal(t, "{\"status\":\"success\",\"errorType\":\"\",\"error\":\"\"}", w.Body.String())
340+
require.Equal(t, "{\"status\":\"success\"}", w.Body.String())
341341

342342
// On Partial failures
343343
req = requestFor(t, http.MethodDelete, "https://localhost:8080/api/v1/rules/namespace2", nil, "user1")
@@ -430,7 +430,7 @@ rules:
430430
- record: up_rule
431431
expr: up{}
432432
`,
433-
output: "{\"status\":\"success\",\"errorType\":\"\",\"error\":\"\"}",
433+
output: "{\"status\":\"success\"}",
434434
},
435435
{
436436
name: "when exceeding the rule group limit after sending the first group",
@@ -490,7 +490,7 @@ rules:
490490
expr: |2+
491491
up{}
492492
`,
493-
output: "{\"status\":\"success\",\"errorType\":\"\",\"error\":\"\"}",
493+
output: "{\"status\":\"success\"}",
494494
},
495495
{
496496
name: "when pushing group that CANNOT be safely converted from RuleGroupDesc to RuleGroup yaml",

pkg/util/api/response.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const (
2020
type Response struct {
2121
Status string `json:"status"`
2222
Data interface{} `json:"data,omitempty"`
23-
ErrorType v1.ErrorType `json:"errorType"`
24-
Error string `json:"error"`
23+
ErrorType v1.ErrorType `json:"errorType,omitempty"`
24+
Error string `json:"error,omitempty"`
2525
Warnings []string `json:"warnings,omitempty"`
2626
}
2727

0 commit comments

Comments
 (0)