Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions internal/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ import (
)

var (
config = sonicjson.Config{
CaseSensitive: true,
}.Froze()

// Unmarshal is equivalent to encoding/json.Unmarshal.
Unmarshal = sonicjson.ConfigDefault.Unmarshal
Unmarshal = config.Unmarshal
// Marshal is equivalent to encoding/json.Marshal.
Marshal = sonicjson.ConfigDefault.Marshal
Marshal = config.Marshal
// NewEncoder is equivalent to encoding/json.NewEncoder.
NewEncoder = sonicjson.ConfigDefault.NewEncoder
NewEncoder = config.NewEncoder
// NewDecoder is equivalent to encoding/json.NewDecoder.
NewDecoder = sonicjson.ConfigDefault.NewDecoder
NewDecoder = config.NewDecoder
// MarshalForDeterministicTesting marshals a value to JSON in a deterministic way for testing.
// The normal sonic configuration does not guarantee deterministic output in terms of field order.
// It panics if called outside of tests.
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/token_ratelimit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ func Test_Examples_TokenRateLimit(t *testing.T) {
Result []struct {
Metric map[string]string `json:"metric"`
Value []any `json:"value"`
}
}
} `json:"result"`
} `json:"data"`
}
var pr prometheusResponse
require.NoError(t, json.Unmarshal(body, &pr))
Expand Down