http请求超时后,报空指针了,不知道什么问题

donovan · · 2262 次点击
写错了。。defer判断一下response是不是nil
#4
更多评论
```go response, errr := client.Do(request) if errr != nil { dlog.Errorf("format of data is wrong||input=%+v||error=%+v\n", input, errj) return -1, errr } defer response.Body.Close() ``
#1
```go response, errr := client.Do(request) if errr != nil { dlog.Errorf("format of data is wrong||input=%+v||error=%+v\n", input, errj) return -1, errr } defer response.Body.Close() ```
#2