mirror of
https://github.com/gin-gonic/gin.git
synced 2026-11-23 11:33:37 +08:00
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:
parent
4acc3a035c
commit
f0c5d1ecaf
1
.github/workflows/gin.yml
vendored
1
.github/workflows/gin.yml
vendored
@ -43,6 +43,7 @@ jobs:
|
||||
"-tags nomsgpack",
|
||||
'--ldflags="-checklinkname=0" -tags sonic',
|
||||
"-tags go_json",
|
||||
"-tags jsoniter",
|
||||
"-race",
|
||||
]
|
||||
include:
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user