Files
gf/g/net/ghttp/http_client_response.go
2017-12-07 14:57:16 +08:00

20 lines
329 B
Go

package ghttp
import (
"io/ioutil"
)
// 获取返回的数据
func (r *ClientResponse) ReadAll() []byte {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
return nil
}
return body
}
// 关闭返回的HTTP链接
func (r *ClientResponse) Close() {
r.Response.Close = true
r.Body.Close()
}