diff options
author | Unknwon <u@gogs.io> | 2018-06-09 17:32:58 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-06-09 17:32:58 +0800 |
commit | fbecc18e2e4d4eb863a990a57218305f190ae6db (patch) | |
tree | 11278a833eec45d8bf710f4e6e27481975b96eaa /pkg/httplib | |
parent | b538c5345e1271fcaf413b82ba1ece555dd635a5 (diff) |
*: use jsoniter to replace encoding/json
Diffstat (limited to 'pkg/httplib')
-rw-r--r-- | pkg/httplib/httplib.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/pkg/httplib/httplib.go b/pkg/httplib/httplib.go index deca5db5..55b17d93 100644 --- a/pkg/httplib/httplib.go +++ b/pkg/httplib/httplib.go @@ -8,7 +8,6 @@ package httplib import ( "bytes" "crypto/tls" - "encoding/json" "encoding/xml" "io" "io/ioutil" @@ -23,6 +22,8 @@ import ( "strings" "sync" "time" + + "github.com/json-iterator/go" ) var defaultSetting = Settings{false, "GogsServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false} @@ -416,8 +417,7 @@ func (r *Request) ToJson(v interface{}) error { if err != nil { return err } - err = json.Unmarshal(data, v) - return err + return jsoniter.Unmarshal(data, v) } // ToXml returns the map that marshals from the body bytes as xml in response . @@ -427,8 +427,7 @@ func (r *Request) ToXml(v interface{}) error { if err != nil { return err } - err = xml.Unmarshal(data, v) - return err + return xml.Unmarshal(data, v) } // Response executes request client gets response mannually. |