Tao Wen 7 vuotta sitten
vanhempi
commit
07f99a1124
2 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa
  1. 2 2
      api_tests/decoder_test.go
  2. 1 0
      feature_config_with_sync_map.go

+ 2 - 2
api_tests/decoder_test.go

@@ -2,7 +2,7 @@ package test
 
 import (
 	"bytes"
-	"github.com/json-iterator/go"
+	"encoding/json"
 	"github.com/stretchr/testify/require"
 	"testing"
 )
@@ -11,7 +11,7 @@ func Test_disallowUnknownFields(t *testing.T) {
 	should := require.New(t)
 	type TestObject struct{}
 	var obj TestObject
-	decoder := jsoniter.NewDecoder(bytes.NewBufferString(`{"field1":100}`))
+	decoder := json.NewDecoder(bytes.NewBufferString(`{"field1":100}`))
 	decoder.DisallowUnknownFields()
 	should.Error(decoder.Decode(&obj))
 }

+ 1 - 0
feature_config_with_sync_map.go

@@ -13,6 +13,7 @@ type frozenConfig struct {
 	indentionStep                 int
 	objectFieldMustBeSimpleString bool
 	onlyTaggedField               bool
+	disallowUnknownFields         bool
 	decoderCache                  sync.Map
 	encoderCache                  sync.Map
 	extensions                    []Extension