mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-13 09:12:28 +08:00
refactor: rename ParseResponse to ParseHttpResponse func in netutil/request.go
This commit is contained in:
@@ -45,8 +45,8 @@ func HttpPatch(url string, params ...interface{}) (*http.Response, error) {
|
|||||||
return request(http.MethodPatch, url, params...)
|
return request(http.MethodPatch, url, params...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseResponse convert the http response to interface{} obj
|
// ParseHttpResponse convert the http response to interface{} obj
|
||||||
func ParseResponse(resp *http.Response, obj interface{}) error {
|
func ParseHttpResponse(resp *http.Response, obj interface{}) error {
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
return errors.New("InvalidResp")
|
return errors.New("InvalidResp")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ func TestParseResponse(t *testing.T) {
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
userResp := &UserResp{}
|
userResp := &UserResp{}
|
||||||
err = ParseResponse(resp, userResp)
|
err = ParseHttpResponse(resp, userResp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
|
|||||||
Reference in New Issue
Block a user