读取io.ReadCloser中读取数据
func ReadBody (resp *http.Response) {
resBody := resp.Body
buf := new(bytes.Buffer)
buf.ReadFrom(resBody)
fmt.Println(buf.String())
fmt.Println(buf.Bytes())
}
读取io.ReadCloser中读取数据
func ReadBody (resp *http.Response) {
resBody := resp.Body
buf := new(bytes.Buffer)
buf.ReadFrom(resBody)
fmt.Println(buf.String())
fmt.Println(buf.Bytes())
}
转载于:https://my.oschina.net/imhuayi/blog/1833222