ci: run the test suite with the jsoniter build tag

The jsoniter build tag is documented in docs/doc.md but was never covered by the CI matrix, so codec/json/jsoniter.go was neither compiled nor tested. Add it alongside the existing sonic and go_json entries.

TestContextBindRequestTooLarge now expects a generic 400 for jsoniter: like goccy/go-json, it does not propagate http.MaxBytesError, so MustBindWith cannot detect it via errors.As.
This commit is contained in:
chuanye-gao 2026-09-27 22:57:37 +08:00
parent 4acc3a035c
commit f0c5d1ecaf
2 changed files with 4 additions and 3 deletions

View File

@ -43,6 +43,7 @@ jobs:
"-tags nomsgpack",
'--ldflags="-checklinkname=0" -tags sonic',
"-tags go_json",
"-tags jsoniter",
"-race",
]
include:

View File

@ -2321,12 +2321,12 @@ func TestContextContentType(t *testing.T) {
}
func TestContextBindRequestTooLarge(t *testing.T) {
// When using go-json as JSON encoder, they do not propagate the http.MaxBytesError error
// The response will fail with a generic 400 instead of 413
// When using go-json or jsoniter as JSON encoder, they do not propagate the
// http.MaxBytesError error. The response will fail with a generic 400 instead of 413.
// https://github.com/goccy/go-json/issues/485
var expectedCode int
switch json.Package {
case "github.com/goccy/go-json":
case "github.com/goccy/go-json", "github.com/json-iterator/go":
expectedCode = http.StatusBadRequest
default:
expectedCode = http.StatusRequestEntityTooLarge