go两种方式读取http.Request数据

buf := new(bytes.Buffer)
buf.ReadFrom(r.Body)
fmt.Println(buf.String())
//第二种方式
res,_:=ioutil.ReadAll(r.Body)
fmt.Println(string(res))

猜你喜欢

转载自hhg08.iteye.com/blog/2304869