mirror of
https://gitee.com/johng/gf
synced 2026-07-04 21:03:13 +08:00
20 lines
329 B
Go
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()
|
|
} |