Call ReadAll() function in Close() of gClient

This commit is contained in:
huangqian
2022-05-12 20:08:24 +08:00
parent baf4cc1d1c
commit 17fc1ce174
2 changed files with 1 additions and 1 deletions

View File

@ -75,5 +75,6 @@ func (r *Response) Close() error {
return nil
}
r.Response.Close = true
r.ReadAll()
return r.Response.Body.Close()
}

View File

@ -132,7 +132,6 @@ func ExampleNew_MultiConn_Recommend() {
if r, err := client.Get(ctx, "http://127.0.0.1:8999/var/json"); err != nil {
panic(err)
} else {
// Make sure call the ReadAllString() Funcion, Otherwise the program will block here
fmt.Println(r.ReadAllString())
r.Close()
}