We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 07f99a1 commit 002b5aeCopy full SHA for 002b5ae
api_tests/decoder_test.go
@@ -2,16 +2,16 @@ package test
2
3
import (
4
"bytes"
5
- "encoding/json"
6
"github.com/stretchr/testify/require"
7
"testing"
+ "github.com/json-iterator/go"
8
)
9
10
func Test_disallowUnknownFields(t *testing.T) {
11
should := require.New(t)
12
type TestObject struct{}
13
var obj TestObject
14
- decoder := json.NewDecoder(bytes.NewBufferString(`{"field1":100}`))
+ decoder := jsoniter.NewDecoder(bytes.NewBufferString(`{"field1":100}`))
15
decoder.DisallowUnknownFields()
16
should.Error(decoder.Decode(&obj))
17
}
0 commit comments