Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: panic on convert to string on fillSliceFromString() #1951

Merged
merged 3 commits into from Jun 2, 2022
Merged

fix: panic on convert to string on fillSliceFromString() #1951

merged 3 commits into from Jun 2, 2022

Conversation

cjf8134
Copy link
Contributor

@cjf8134 cjf8134 commented Jun 1, 2022

fix: 修复fillSliceFromString()方法中mapValue 强转string后的panic 错误

 fix: 修复fillSliceFromString()方法中mapValue 强转string后的panic 错误
@kevwan
Copy link
Contributor

kevwan commented Jun 1, 2022

need unit test.

@kevwan kevwan changed the title fix: 修复fillSliceFromString()方法中mapValue 强转string后的panic 错误 fix: panic on convert to string on fillSliceFromString() Jun 1, 2022
@cjf8134
Copy link
Contributor Author

cjf8134 commented Jun 2, 2022

// 测试json参数
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, 2, len(res.ID))
}

增加单元测试
@kevwan
Copy link
Contributor

kevwan commented Jun 2, 2022

This test case passed even without this PR.

@kevwan kevwan merged commit 07145b2 into zeromicro:master Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants