diff --git a/context_test.go b/context_test.go index 839d5e74..99238714 100644 --- a/context_test.go +++ b/context_test.go @@ -1851,7 +1851,7 @@ func TestContextContentType(t *testing.T) { func TestContextBindRequestTooLarge(t *testing.T) { // Disabling this test when using sonic as JSON encoder because it doesn't cascade the error correctly - if json.IsSonic { + if json.Package == "github.com/bytedance/sonic" { t.Skip() return } diff --git a/internal/json/go_json.go b/internal/json/go_json.go index 47c35598..dee09dec 100644 --- a/internal/json/go_json.go +++ b/internal/json/go_json.go @@ -20,3 +20,6 @@ var ( // NewEncoder is exported by gin/json package. NewEncoder = json.NewEncoder ) + +// Package indicates what library is being used for JSON encoding. +const Package = "github.com/goccy/go-json" diff --git a/internal/json/json.go b/internal/json/json.go index e4ff16f9..539daa78 100644 --- a/internal/json/json.go +++ b/internal/json/json.go @@ -21,5 +21,5 @@ var ( NewEncoder = json.NewEncoder ) -// IsSonic indicates whether the sonic library is being used for JSON encoding. -const IsSonic = false +// Package indicates what library is being used for JSON encoding. +const Package = "encoding/json" diff --git a/internal/json/jsoniter.go b/internal/json/jsoniter.go index 45ed16ba..287ebf70 100644 --- a/internal/json/jsoniter.go +++ b/internal/json/jsoniter.go @@ -21,3 +21,6 @@ var ( // NewEncoder is exported by gin/json package. NewEncoder = json.NewEncoder ) + +// Package indicates what library is being used for JSON encoding. +const Package = "github.com/json-iterator/go" diff --git a/internal/json/sonic.go b/internal/json/sonic.go index af1330e6..b3f72424 100644 --- a/internal/json/sonic.go +++ b/internal/json/sonic.go @@ -22,5 +22,5 @@ var ( NewEncoder = json.NewEncoder ) -// IsSonic indicates whether the sonic library is being used for JSON encoding. -const IsSonic = true +// Package indicates what library is being used for JSON encoding. +const Package = "github.com/bytedance/sonic"