fix: wrong way of Unmarshal
I faced a minor problem when I used it. for examlpe:
type request {
Bytes []byte `json:"bytes"`
Name string `json:"name"`
}
type response {}
service template {
@handler postDataTest
post /test (request) returns (response)
@handler getJsonData
get /get returns (request)
}
and get returns
&types.Request{
Bytes: []byte("11122344wsss"),
Name: "test",
}
It's ok when I visit /get api ,but when I put /get response (the json data of request) into /test error happend:
fullName: `bytes`, error: `string: `MTExMjIzNDR3c3Nz`, error: `invalid character 'M' looking for beginning of value``
and I notice that ,there use json.Marshal() to make the response but use slef custom mapping.UnmarshalJsonReader to Unmarshal json data
so I just fix it (core in mapping.processFieldNotFromString).
You can see test in TestUnmarshalJsonReaderMultiArray
@kevwan please help review
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 94.56%. Comparing base (
8690859) to head (c7683bf). Report is 226 commits behind head on master.
Additional details and impacted files
| Files with missing lines | Coverage Δ | |
|---|---|---|
| core/mapping/unmarshaler.go | 96.28% <100.00%> (-0.20%) |
:arrow_down: |