appsrv: FetchStruct(): 使用jsonutils

This commit is contained in:
Yousong Zhou
2018-12-23 15:26:50 +00:00
parent cf51c8ff9d
commit ae40f39d32
+5 -2
View File
@@ -1,7 +1,6 @@
package appsrv
import (
"encoding/json"
"io/ioutil"
"net/http"
@@ -19,7 +18,11 @@ func FetchStruct(req *http.Request, v interface{}) error {
return e
}
if len(b) > 0 {
return json.Unmarshal(b, v)
obj, err := jsonutils.Parse(b)
if err != nil {
return err
}
return obj.Unmarshal(v)
} else {
return nil
}