fix: panic on convert to string on fillSliceFromString() (#1951)
* Update unmarshaler.go fix: 修复fillSliceFromString()方法中mapValue 强转string后的panic 错误 * test: 增加单元测试 增加单元测试 * Update unmarshaler_test.go
This commit is contained in:
@@ -2789,3 +2789,14 @@ func BenchmarkDefaultValue(b *testing.B) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalJsonReaderArray(t *testing.T) {
|
||||
payload := "{\"id\": 123}"
|
||||
var res struct {
|
||||
ID []string `json:"id"`
|
||||
}
|
||||
reader := strings.NewReader(payload)
|
||||
err := UnmarshalJsonReader(reader, &res)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 1, len(res.ID))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user