1. 首页
  2. 数据库
  3. 其它
  4. 【Golang】Http请求返回结果处理

【Golang】Http请求返回结果处理

上传者: 2021-01-17 00:25:54上传 PDF文件 21.51KB 热度 38次
在 Go 中 Http 请求的返回结果为 *http.Response 类型,Response.Body 类型为 io.Reader,把请求结果转化为Map需要进行一些处理。 写一个公共方法来进行Response转Map处理: package util import ( encoding/json net/http io/ioutil ) func ParseResponse(response *http.Response) (map[string]interface{}, error){ var result map[string]interface{}
下载地址
用户评论